diff options
| author | Éric Araujo <earaujo@caravan.coop> | 2020-01-16 16:11:18 -0500 |
|---|---|---|
| committer | Éric Araujo <earaujo@caravan.coop> | 2020-01-16 16:11:18 -0500 |
| commit | b102650f3ba20d3153ddff005d49f8c33fef8886 (patch) | |
| tree | ef36934735de9509f6d660782aedd9233382e865 /docs/tutorials/wiki/definingmodels.rst | |
| parent | d741e9baca9c6aa76158341aae4b4310b3745b7b (diff) | |
| parent | 9c153e1250e00faa06003c10c3a26886489e6210 (diff) | |
| download | pyramid-b102650f3ba20d3153ddff005d49f8c33fef8886.tar.gz pyramid-b102650f3ba20d3153ddff005d49f8c33fef8886.tar.bz2 pyramid-b102650f3ba20d3153ddff005d49f8c33fef8886.zip | |
merge master
Diffstat (limited to 'docs/tutorials/wiki/definingmodels.rst')
| -rw-r--r-- | docs/tutorials/wiki/definingmodels.rst | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/docs/tutorials/wiki/definingmodels.rst b/docs/tutorials/wiki/definingmodels.rst index 3a340e6f7..3b1e38c7d 100644 --- a/docs/tutorials/wiki/definingmodels.rst +++ b/docs/tutorials/wiki/definingmodels.rst @@ -43,8 +43,11 @@ Open ``tutorial/models/__init__.py`` file and edit it to look like the following .. literalinclude:: src/models/tutorial/models/__init__.py :linenos: + :emphasize-lines: 1,5-11,15-19 :language: python +The emphasized lines indicate changes, described as follows. + Remove the ``MyModel`` class from the generated ``models/__init__.py`` file. The ``MyModel`` class is only a sample and we're not going to use it. @@ -60,8 +63,9 @@ We will use this for a new ``Page`` class in a moment. Then we add a ``Wiki`` class. .. literalinclude:: src/models/tutorial/models/__init__.py - :lines: 4-6 + :pyobject: Wiki :lineno-match: + :emphasize-lines: 1-3 :language: py We want it to inherit from the :class:`persistent.mapping.PersistentMapping` class because it provides mapping behavior. @@ -74,8 +78,9 @@ The ``__name__`` of the root model is also always ``None``. Now we add a ``Page`` class. .. literalinclude:: src/models/tutorial/models/__init__.py - :lines: 8-10 + :pyobject: Page :lineno-match: + :emphasize-lines: 1-3 :language: py This class should inherit from the :class:`persistent.Persistent` class. @@ -91,9 +96,9 @@ We will create this function in the next chapter. As a last step, edit the ``appmaker`` function. .. literalinclude:: src/models/tutorial/models/__init__.py - :lines: 12-20 + :pyobject: appmaker :lineno-match: - :emphasize-lines: 4-8 + :emphasize-lines: 3-7 :language: py The :term:`root` :term:`resource` of our application is a Wiki instance. |
