Skip to content

Commit 5b67a93

Browse files
committed
use include
1 parent 33adb28 commit 5b67a93

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

source/includes/interact-data/raw-queries.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ def __str__(self):
3131
# end-models
3232

3333
# start-filter-project
34-
from sample_mflix.models import Movie
35-
3634
movies = Movie.objects.raw_aggregate([
3735
{"$match": {"title": "The Parent Trap"}},
3836
{"$project": {

source/includes/use-sample-data.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
|model-imports|
20+
21+
To learn how to create a {+framework+} application that uses the ``Movie``
22+
model and the Python interactive shell to interact with MongoDB documents,
23+
visit the :ref:`django-get-started` tutorial.

source/interact-data/raw-queries.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,19 @@ definitions:
6565
:language: python
6666
:copyable:
6767

68-
To learn how to create a Django application that uses a similar ``Movie``
69-
model to interact with MongoDB documents, visit the :ref:`django-get-started`
70-
tutorial.
68+
.. include:: /includes/use-sample-data.rst
69+
70+
.. replacement:: model-classes
71+
72+
``Movie`` and ``Theater`` models include
73+
74+
.. replacement:: model-imports
75+
76+
.. code-block:: python
77+
78+
from <your application name>.models import Movie, Theater
79+
from {+framework+}.utils import timezone
80+
from datetime import datetime
7181

7282
.. _django-raw-queries-run:
7383

0 commit comments

Comments
 (0)