@@ -33,22 +33,22 @@ complex matching criteria.
3333Query API
3434~~~~~~~~~
3535
36- The Django ``QuerySet`` API provides methods that allow you to retrieve
36+ The {+framework+} ``QuerySet`` API provides methods that allow you to retrieve
3737model objects. To run a MongoDB database query, call ``QuerySet`` methods
3838on your model's manager. The ``Manager`` class handles database
3939operations and allows you to interact with your MongoDB data by referencing
40- Django models. By default, Django adds a ``Manager`` named ``objects``
40+ {+framework+} models. By default, {+framework+} adds a ``Manager`` named ``objects``
4141to every model class.
4242
4343When you assign a ``QuerySet`` to a variable, {+django-odm+} does not
4444perform the operation until you evaluate the variable. After
45- evaluating the ``QuerySet``, Django saves the query results in the ``QuerySet``
45+ evaluating the ``QuerySet``, {+framework+} saves the query results in the ``QuerySet``
4646cache. Future evaluations of the ``QuerySet`` use the cached results.
4747
4848.. tip::
4949
50- To learn more about the Django ``QuerySet`` API, see `QuerySet API reference
51- <{+django-docs+}/ref/models/querysets/>`__ in the Django documentation.
50+ To learn more about the {+framework+} ``QuerySet`` API, see `QuerySet API reference
51+ <{+django-docs+}/ref/models/querysets/>`__ in the {+framework+} documentation.
5252
5353Sample Data
5454~~~~~~~~~~~
@@ -64,26 +64,19 @@ of its ``awards`` field. These model classes have the following definitions:
6464 :language: python
6565 :copyable:
6666
67- You can use the Python interactive shell to run the code examples.
68- To enter the shell, run the following command from your project's
69- root directory:
67+ .. include:: /includes/use-sample-data.rst
7068
71- .. code-block :: bash
69+ .. replacement :: model-classes
7270
73- python manage.py shell
71+ ``Movie`` model includes
7472
75- After entering the Python shell, ensure that you import the following models and
76- modules:
73+ .. replacement:: model-imports
7774
78- .. code-block:: python
79-
80- from <your application name>.models import Movie, Award
81- from django.utils import timezone
82- from datetime import datetime
75+ .. code-block:: python
8376
84- To learn how to create a Django application that uses the `` Movie``
85- model and the Python interactive shell to interact with MongoDB documents,
86- visit the :ref:`django-get-started` tutorial.
77+ from <your application name>.models import Movie, Award
78+ from django.utils import timezone
79+ from datetime import datetime
8780
8881Run a Query
8982-----------
@@ -243,7 +236,7 @@ from the results:
243236Run Raw Database Queries
244237~~~~~~~~~~~~~~~~~~~~~~~~
245238
246- If you want to run complex queries that Django 's query API
239+ If you want to run complex queries that {+framework+} 's query API
247240does not support, you can use the ``raw_aggregate()`` method. This
248241method allows you to specify your query criteria in a MongoDB
249242aggregation pipeline, which you pass as an argument to
@@ -275,7 +268,7 @@ expression matching, and year value matching for datetime fields.
275268
276269 To view a full list of lookup types, see `Field lookups
277270 <{+django-docs+}/ref/models/querysets/#field-lookups>`__ in the
278- ``QuerySet`` Django API reference.
271+ ``QuerySet`` {+framework+} API reference.
279272
280273This section describes how to refine your query filters
281274in the following ways:
@@ -424,15 +417,15 @@ in the following ways:
424417- Pass multiple query filters to your query method, separated
425418 by commas. To view an example, see `Retrieving objects
426419 <{+django-docs+}/topics/db/queries/#retrieving-objects>`__ in the
427- Django documentation.
420+ {+framework+} documentation.
428421
429422- Chain query methods together. To learn more, see `Chaining filters
430- <{+django-docs+}/topics/db/queries/#chaining-filters>`__ in the Django
423+ <{+django-docs+}/topics/db/queries/#chaining-filters>`__ in the {+framework+}
431424 documentation.
432425
433426- Use ``Q`` objects and separate each object with a logical operator.
434427 To learn more, see `Complex lookups with Q objects
435- <{+django-docs+}/topics/db/queries/#complex-lookups-with-q-objects>`__ in the Django
428+ <{+django-docs+}/topics/db/queries/#complex-lookups-with-q-objects>`__ in the {+framework+}
436429 documentation.
437430
438431Q Object Example
@@ -766,7 +759,7 @@ provided ``KT()`` expressions.
766759.. tip::
767760
768761 To learn more about ``KT()`` expressions and the ``annotate()`` method,
769- see the following resources in the Django documentation:
762+ see the following resources in the {+framework+} documentation:
770763
771764 - `KT() expressions <{+django-docs+}/topics/db/queries/#module-django.db.models.fields.json>`__
772765 - `annotate() <{+django-docs+}/ref/models/querysets/#django.db.models.query.QuerySet.annotate>`__
@@ -842,5 +835,5 @@ pipeline syntax, see the :ref:`django-raw-queries` guide.
842835To learn how to perform other ``QuerySet`` operations, see the
843836:ref:`django-crud` guide.
844837
845- To learn more about Django queries, see `Making queries <{+django-docs+}/topics/db/queries>`__
846- in the Django documentation.
838+ To learn more about {+framework+} queries, see `Making queries <{+django-docs+}/topics/db/queries>`__
839+ in the {+framework+} documentation.
0 commit comments