Commit 9c940c46 authored by François Ferry's avatar François Ferry
Browse files

doc(tuto): rename cubicweb-tuto to tuto, avoiding confusion with cubicweb_tuto

parent 2ab11cffd43b
Pipeline #45277 passed with stages
in 7 minutes and 20 seconds
......@@ -18,7 +18,7 @@ available here_.
There are several ways to import data in CubicWeb; in this tutorial, we will use one of them,
the others are described here: :ref:`dataimport`.
First of all, we define in :file:`cubicweb-tuto/dataimport.py` a function which will read a file
First of all, we define in :file:`tuto/cubicweb_tuto/dataimport.py` a function which will read a file
from a `filepath` and create the corresponding entities, using a `CubicWeb connection`:
.. sourcecode:: python
......@@ -79,7 +79,7 @@ If not, we create it. Then, we create our Museum entity with all needed argument
To create an entity, we use the `create_entity` method of the CubicWeb connection. This method takes
as first argument the type of the entity (ie: the name of the corresponding class previously
defined in :file:`cubicweb-tuto/schema.py`), and then all arguments of the entity type.
defined in :file:`tuto/cubicweb_tuto/schema.py`), and then all arguments of the entity type.
In our example, a city needs a name and a zip code. A museum needs a name, a postal address,
a latitude, a longitude and a city. As `is_in` is a relation, we give to the corresponding argument
......@@ -97,7 +97,7 @@ the eid of the city.
museum_entity.cw_set(is_in=city)
To use our function we need to create a CubicWeb command that will call it. First, we create a file
:file:`cubicweb-tuto/ccplugin.py` (the name doesn't matter, but it is commonly used for all new
:file:`tuto/cubicweb_tuto/ccplugin.py` (the name doesn't matter, but it is commonly used for all new
CubicWeb commands). Then, we write the following code:
.. sourcecode:: python
......
......@@ -28,13 +28,13 @@ We will call our cube ``tuto``:
.. code-block:: console
cubicweb-ctl newcube tuto
cubicweb-ctl newcube tuto -d tuto
This command will lead to several questions, as a short description of the new cube. Then, it will
create a directory named :file:`cubicweb-tuto` reflecting the structure described in
:ref:`cubelayout`.
create a directory named :file:`tuto` (as we specified it with `-d`) reflecting the structure
described in :ref:`cubelayout`.
To install our new cube on the virtual environment, run in the :file:`cubicweb-tuto` directory:
To install our new cube on the virtual environment, run in the :file:`tuto` directory:
.. code-block:: console
......@@ -78,7 +78,7 @@ We want to display some museums, each have a name, a postal address,
maybe one or several director, a geographical position (latitude and longitude) and are in a
city. Some of these concepts will be classes, others attributes.
Thus, we will write the following code in our :file:`cubicweb-tuto/schema.py` file:
Thus, we will write the following code in our :file:`tuto/cubicweb_tuto/schema.py` file:
.. sourcecode:: python
......@@ -263,7 +263,7 @@ subclass it. More information are available here : :ref:`primary_view`.
Now we have several museums, we want an easier way to identify its city when we are on the
museum page. To achieve this, we will subclass `PrimaryView` and override `render_entity_title`
method in :file:`cubicweb-tuto/views.py`:
method in :file:`tuto/cubicweb_tuto/views.py`:
.. sourcecode:: python
......@@ -315,7 +315,7 @@ method, etc...
As we may want reuse our custom museum title (with city name, as defined in previous section),
we will define it as a property of our Museum class.
To do so, write this code in :file:`cubicweb-tuto/entities.py`:
To do so, write this code in :file:`tuto/cubicweb_tuto/entities.py`:
.. sourcecode:: python
......@@ -329,7 +329,7 @@ To do so, write this code in :file:`cubicweb-tuto/entities.py`:
def title_with_city(self):
return f"{self.name} ({self.is_in[0].name})"
Then, we just have to use it our previously defined view in :file:`cubicweb-tuto/views.py`:
Then, we just have to use it our previously defined view in :file:`tuto/cubicweb_tuto/views.py`:
.. sourcecode:: python
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment