2 |
2 |
3 Create your cube |
3 Create your cube |
4 ---------------- |
4 ---------------- |
5 |
5 |
6 The packages ``cubicweb`` and ``cubicweb-dev`` installs a command line tool |
6 The packages ``cubicweb`` and ``cubicweb-dev`` installs a command line tool |
7 for `CubicWeb` called ``cubicweb-ctl``. This tool provides a wide range of |
7 for *CubicWeb* called ``cubicweb-ctl``. This tool provides a wide range of |
8 commands described in details in :ref:`cubicweb-ctl`. |
8 commands described in details in :ref:`cubicweb-ctl`. |
9 |
9 |
10 Once your `CubicWeb` development environment is set up, you can create a new |
10 Once your *CubicWeb* development environment is set up, you can create a new |
11 cube:: |
11 cube:: |
12 |
12 |
13 cubicweb-ctl newcube blog |
13 cubicweb-ctl newcube blog |
14 |
14 |
15 This will create in the cubes directory (``/path/to/forest/cubes`` for Mercurial |
15 This will create in the cubes directory (``/path/to/forest/cubes`` for Mercurial |
19 .. _DefineDataModel: |
19 .. _DefineDataModel: |
20 |
20 |
21 Define your data model |
21 Define your data model |
22 ---------------------- |
22 ---------------------- |
23 |
23 |
24 The data model or schema is the core of your `CubicWeb` application. |
24 The data model or schema is the core of your *CubicWeb* application. |
25 It defines the type of content your application will handle. |
25 It defines the type of content your application will handle. |
26 |
26 |
27 The data model of your cube ``blog`` is defined in the file ``schema.py``: |
27 The data model of your cube ``blog`` is defined in the file ``schema.py``: |
28 |
28 |
29 :: |
29 :: |
89 Once authenticated, you can start playing with your application |
89 Once authenticated, you can start playing with your application |
90 and create entities. |
90 and create entities. |
91 |
91 |
92 .. image:: ../../images/blog-demo-first-page.png |
92 .. image:: ../../images/blog-demo-first-page.png |
93 |
93 |
94 Please notice that so far, the `CubicWeb` franework managed all aspects of |
94 Please notice that so far, the *CubicWeb* franework managed all aspects of |
95 the web application based on the schema provided at first. |
95 the web application based on the schema provided at first. |
96 |
96 |
97 |
97 |
98 Add entities |
98 Add entities |
99 ------------ |
99 ------------ |
181 The view selection principle |
181 The view selection principle |
182 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
182 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
183 |
183 |
184 A view is defined by a Python class which includes: |
184 A view is defined by a Python class which includes: |
185 |
185 |
186 - an identifier (all objects in `CubicWeb` are entered in a registry |
186 - an identifier (all objects in *CubicWeb* are entered in a registry |
187 and this identifier will be used as a key) |
187 and this identifier will be used as a key) |
188 |
188 |
189 - a filter to select the result sets it can be applied to |
189 - a filter to select the result sets it can be applied to |
190 |
190 |
191 A view has a set of methods complying |
191 A view has a set of methods complying |
192 with the `View` class interface (`cubicweb.common.view`). |
192 with the `View` class interface (`cubicweb.common.view`). |
193 |
193 |
194 `CubicWeb` provides a lot of standard views for the type `EntityView`; |
194 *CubicWeb* provides a lot of standard views for the type `EntityView`; |
195 for a complete list, read the code in directory ``cubicweb/web/views/``. |
195 for a complete list, read the code in directory ``cubicweb/web/views/``. |
196 |
196 |
197 A view is applied on a `result set` which contains a set of |
197 A view is applied on a `result set` which contains a set of |
198 entities we are trying to display. `CubicWeb` uses a selector |
198 entities we are trying to display. *CubicWeb* uses a selector |
199 mechanism which computes for each available view a score: |
199 mechanism which computes for each available view a score: |
200 the view with the highest score is then used to display the given `result set`. |
200 the view with the highest score is then used to display the given `result set`. |
201 The standard library of selectors is in |
201 The standard library of selectors is in |
202 ``cubicweb.common.selector`` and a library of methods used to |
202 ``cubicweb.common.selector`` and a library of methods used to |
203 compute scores is available in ``cubicweb.vregistry.vreq``. |
203 compute scores is available in ``cubicweb.vregistry.vreq``. |