Skip to content

Commit ed1799f

Browse files
committed
use include
1 parent 509823b commit ed1799f

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

source/includes/use-sample-data.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
The |model-classes| an inner ``Meta`` class and a ``__str__()`` method.
2+
To learn about these model features, see :ref:`django-models-define` in the
3+
Create Models guide.
4+
5+
Run Code Examples
6+
`````````````````
7+
8+
You can use the Python interactive shell to run the code examples.
9+
To enter the shell, run the following command from your project's
10+
root directory:
11+
12+
.. code-block:: bash
13+
14+
python manage.py shell
15+
16+
After entering the Python shell, ensure that you import the following models and
17+
modules:
18+
19+
.. code-block:: python
20+
21+
|model-imports|
22+
from {+framework+}.utils import timezone
23+
from datetime import datetime
24+
25+
To learn how to create a {+framework+} application that uses the ``Movie``
26+
model and the Python interactive shell to interact with MongoDB documents,
27+
visit the :ref:`django-get-started` tutorial.

source/interact-data/crud.txt

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,15 @@ The ``Movie`` model class has the following definition:
6262
:language: python
6363
:copyable:
6464

65-
The ``Movie`` model class includes an inner ``Meta`` class and a ``__str__()`` method.
66-
To learn about these model features, see :ref:`django-models-define` in the
67-
Create Models guide.
65+
.. include:: /includes/use-sample-data.rst
6866

69-
Run Code Examples
70-
`````````````````
67+
.. replacement:: model-classes
7168

72-
You can use the Python interactive shell to run the code examples.
73-
To enter the shell, run the following command from your project's
74-
root directory:
69+
``Movie`` model includes
7570

76-
.. code-block:: bash
71+
.. replacement:: model-imports
7772

78-
python manage.py shell
79-
80-
After entering the Python shell, ensure that you import the following models and
81-
modules:
82-
83-
.. code-block:: python
84-
85-
from <your application name>.models import Movie
86-
from {+framework+}.utils import timezone
87-
from datetime import datetime
88-
89-
To learn how to create a {+framework+} application that uses the ``Movie``
90-
model and the Python interactive shell to interact with MongoDB documents,
91-
visit the :ref:`django-get-started` tutorial.
73+
from <your application name>.models import Movie
9274

9375
.. _django-crud-insert:
9476

0 commit comments

Comments
 (0)