Skip to content

Commit 26b0055

Browse files
committed
Made directive indentation consistent in docs
The text under a directive should be indented.
1 parent 3885833 commit 26b0055

File tree

7 files changed

+118
-116
lines changed

7 files changed

+118
-116
lines changed

docs/source/ref/django-admin.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Available commands
1919

2020
.. django-admin:: createcachecollection
2121

22-
Creates the cache collection for use with the :doc:`database cache backend
23-
</topics/cache>` using the information from your :setting:`CACHES` setting.
22+
Creates the cache collection for use with the :doc:`database cache backend
23+
</topics/cache>` using the information from your :setting:`CACHES` setting.
2424

25-
.. django-admin-option:: --database DATABASE
25+
.. django-admin-option:: --database DATABASE
2626

27-
Specifies the database in which the cache collection(s) will be created.
28-
Defaults to ``default``.
27+
Specifies the database in which the cache collection(s) will be created.
28+
Defaults to ``default``.

docs/source/ref/forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Some MongoDB-specific fields are available in ``django_mongodb_backend.forms``.
2828

2929
.. class:: ObjectIdField
3030

31-
Stores an :class:`~bson.objectid.ObjectId`.
31+
Stores an :class:`~bson.objectid.ObjectId`.
3232

3333
``SimpleArrayField``
3434
--------------------

docs/source/ref/models/fields.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ These indexes use 0-based indexing.
224224

225225
.. class:: EmbeddedModelField(embedded_model, **kwargs)
226226

227-
Stores a model of type ``embedded_model``.
227+
Stores a model of type ``embedded_model``.
228228

229229
.. attribute:: embedded_model
230230

@@ -256,7 +256,7 @@ Stores a model of type ``embedded_model``.
256256
class Book(models.Model):
257257
author = EmbeddedModelField(Author)
258258

259-
See :doc:`/topics/embedded-models` for more details and examples.
259+
See :doc:`/topics/embedded-models` for more details and examples.
260260

261261
.. admonition:: Migrations support is limited
262262

@@ -273,12 +273,12 @@ See :doc:`/topics/embedded-models` for more details and examples.
273273

274274
.. class:: ObjectIdAutoField
275275

276-
This field is typically the default primary key field for all models stored in
277-
MongoDB. See :ref:`specifying the-default-pk-field`.
276+
This field is typically the default primary key field for all models stored
277+
in MongoDB. See :ref:`specifying the-default-pk-field`.
278278

279279
``ObjectIdField``
280280
-----------------
281281

282282
.. class:: ObjectIdField
283283

284-
Stores an :class:`~bson.objectid.ObjectId`.
284+
Stores an :class:`~bson.objectid.ObjectId`.

docs/source/ref/models/indexes.rst

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,43 @@ available in ``django_mongodb_backend.indexes``.
1414

1515
.. class:: SearchIndex(fields=(), name=None)
1616

17-
.. versionadded:: 5.2.0b0
17+
.. versionadded:: 5.2.0b0
1818

19-
Creates a basic :doc:`search index <atlas:atlas-search/index-definitions>` on
20-
the given field(s).
19+
Creates a basic :doc:`search index <atlas:atlas-search/index-definitions>`
20+
on the given field(s).
2121

22-
Some fields such as :class:`~django.db.models.DecimalField` aren't
23-
supported. See the :ref:`Atlas documentation <atlas:bson-data-chart>` for a
24-
complete list of unsupported data types.
22+
Some fields such as :class:`~django.db.models.DecimalField` aren't
23+
supported. See the :ref:`Atlas documentation <atlas:bson-data-chart>` for a
24+
complete list of unsupported data types.
2525

26-
If ``name`` isn't provided, one will be generated automatically. If you need
27-
to reference the name in your search query and don't provide your own name,
28-
you can lookup the generated one using ``Model._meta.indexes[0].name``
29-
(substiting the name of your model as well as a different list index if your
30-
model has multiple indexes).
26+
If ``name`` isn't provided, one will be generated automatically. If you
27+
need to reference the name in your search query and don't provide your own
28+
name, you can lookup the generated one using ``Model._meta.indexes[0].name``
29+
(substituting the name of your model as well as a different list index if
30+
your model has multiple indexes).
3131

3232
``VectorSearchIndex``
3333
=====================
3434

3535
.. class:: VectorSearchIndex(*, fields=(), name=None, similarities)
3636

37-
.. versionadded:: 5.2.0b0
37+
.. versionadded:: 5.2.0b0
3838

39-
A subclass of :class:`SearchIndex` that creates a :doc:`vector search index
40-
<atlas:atlas-vector-search/vector-search-type>` on the given field(s).
39+
A subclass of :class:`SearchIndex` that creates a :doc:`vector search index
40+
<atlas:atlas-vector-search/vector-search-type>` on the given field(s).
4141

42-
The index must reference at least one vector field: an :class:`.ArrayField`
43-
with a :attr:`~.ArrayField.base_field` of :class:`~django.db.models.FloatField`
44-
or :class:`~django.db.models.IntegerField` and a :attr:`~.ArrayField.size`. It
45-
cannot reference an :class:`.ArrayField` of any other type.
42+
The index must reference at least one vector field: an :class:`.ArrayField`
43+
with a :attr:`~.ArrayField.base_field` of
44+
:class:`~django.db.models.FloatField` or
45+
:class:`~django.db.models.IntegerField` and a :attr:`~.ArrayField.size`. It
46+
cannot reference an :class:`.ArrayField` of any other type.
4647

47-
It may also have other fields to filter on, provided the field stores
48-
``boolean``, ``date``, ``objectId``, ``numeric``, ``string``, or ``uuid``.
48+
It may also have other fields to filter on, provided the field stores
49+
``boolean``, ``date``, ``objectId``, ``numeric``, ``string``, or ``uuid``.
4950

50-
Available values for the required ``similarities`` keyword argument are
51-
``"cosine"``, ``"dotProduct"``, and ``"euclidean"`` (see
52-
:ref:`atlas:avs-similarity-functions` for how to choose). You can provide this
53-
value either a string, in which case that value will be applied to all vector
54-
fields, or a list or tuple of values with a similarity corresponding to each
55-
vector field.
51+
Available values for the required ``similarities`` keyword argument are
52+
``"cosine"``, ``"dotProduct"``, and ``"euclidean"`` (see
53+
:ref:`atlas:avs-similarity-functions` for how to choose). You can provide
54+
this value either a string, in which case that value will be applied to all
55+
vector fields, or a list or tuple of values with a similarity corresponding
56+
to each vector field.

docs/source/ref/models/models.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ One MongoDB-specific model is available in ``django_mongodb_backend.models``.
77

88
.. class:: EmbeddedModel
99

10-
An abstract model which all :doc:`embedded models </topics/embedded-models>`
11-
must subclass.
10+
An abstract model which all :doc:`embedded models </topics/embedded-models>`
11+
must subclass.
1212

13-
Since these models are not stored in their own collection, they do not have
14-
any of the normal ``QuerySet`` methods (``all()``, ``filter()``, ``delete()``,
15-
etc.) You also cannot call ``Model.save()`` and ``delete()`` on them.
13+
Since these models are not stored in their own collection, they do not have
14+
any of the normal ``QuerySet`` methods (``all()``, ``filter()``,
15+
``delete()``, etc.) You also cannot call ``Model.save()`` and ``delete()``
16+
on them.

docs/source/ref/models/querysets.rst

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,34 @@ queries that span multiple collections.
1818
``QuerySet.explain()``
1919
======================
2020

21-
- :meth:`QuerySet.explain() <django.db.models.query.QuerySet.explain>` supports
22-
the `comment and verbosity options
23-
<https://www.mongodb.com/docs/manual/reference/command/explain/#command-fields>`_.
21+
:meth:`QuerySet.explain() <django.db.models.query.QuerySet.explain>` supports
22+
the `comment and verbosity options
23+
<https://www.mongodb.com/docs/manual/reference/command/explain/#command-fields>`_.
2424

25-
Example::
25+
Example::
2626

27-
Model.objects.explain(comment="...", verbosity="...")
27+
Model.objects.explain(comment="...", verbosity="...")
2828

29-
Valid values for ``verbosity`` are ``"queryPlanner"`` (default),
30-
``"executionStats"``, and ``"allPlansExecution"``.
29+
Valid values for ``verbosity`` are ``"queryPlanner"`` (default),
30+
``"executionStats"``, and ``"allPlansExecution"``.
3131

3232
MongoDB-specific ``QuerySet`` methods
3333
=====================================
3434

3535
.. class:: django_mongodb_backend.managers.MongoManager
3636

37-
Some MongoDB-specific ``QuerySet`` methods are available by adding a custom
38-
:class:`~django.db.models.Manager`, ``MongoManager``, to your model::
37+
Some MongoDB-specific ``QuerySet`` methods are available by adding a custom
38+
:class:`~django.db.models.Manager`, ``MongoManager``, to your model::
3939

40-
from django.db import models
40+
from django.db import models
4141

42-
from django_mongodb_backend.managers import MongoManager
42+
from django_mongodb_backend.managers import MongoManager
4343

4444

45-
class MyModel(models.Model):
46-
...
45+
class MyModel(models.Model):
46+
...
4747

48-
objects = MongoManager()
48+
objects = MongoManager()
4949

5050

5151
.. currentmodule:: django_mongodb_backend.queryset.MongoQuerySet
@@ -55,48 +55,48 @@ Some MongoDB-specific ``QuerySet`` methods are available by adding a custom
5555

5656
.. method:: raw_aggregate(pipeline, using=None)
5757

58-
Similar to :meth:`QuerySet.raw()<django.db.models.query.QuerySet.raw>`, but
59-
instead of a raw SQL query, this method accepts a pipeline that will be passed
60-
to :meth:`pymongo.collection.Collection.aggregate`.
61-
62-
For example, you could write a custom match criteria::
63-
64-
Question.objects.raw_aggregate([{"$match": {"question_text": "What's up"}}])
65-
66-
The pipeline may also return additional fields that will be added as
67-
annotations on the models::
68-
69-
>>> questions = Question.objects.raw_aggregate([{
70-
... "$project": {
71-
... "question_text": 1,
72-
... "pub_date": 1,
73-
... "year_published": {"$year": "$pub_date"}
74-
... }
75-
... }])
76-
>>> for q in questions:
77-
... print(f"{q.question_text} was published in {q.year_published}.")
78-
...
79-
What's up? was published in 2024.
80-
81-
Fields may also be left out:
82-
83-
>>> Question.objects.raw_aggregate([{"$project": {"question_text": 1}}])
84-
85-
The ``Question`` objects returned by this query will be deferred model instances
86-
(see :meth:`~django.db.models.query.QuerySet.defer()`). This means that the
87-
fields that are omitted from the query will be loaded on demand. For example::
88-
89-
>>> for q in Question.objects.raw_aggregate([{"$project": {"question_text": 1}}]):
90-
>>> print(
91-
... q.question_text, # This will be retrieved by the original query.
92-
... q.pub_date, # This will be retrieved on demand.
93-
... )
94-
...
95-
What's new 2023-09-03 12:00:00+00:00
96-
What's up 2024-08-23 20:57:30+00:00
97-
98-
From outward appearances, this looks like the query has retrieved both the
99-
question text and published date. However, this example actually issued three
100-
queries. Only the question texts were retrieved by the ``raw_aggregate()``
101-
query -- the published dates were both retrieved on demand when they were
102-
printed.
58+
Similar to :meth:`QuerySet.raw()<django.db.models.query.QuerySet.raw>`, but
59+
instead of a raw SQL query, this method accepts a pipeline that will be passed
60+
to :meth:`pymongo.collection.Collection.aggregate`.
61+
62+
For example, you could write a custom match criteria::
63+
64+
Question.objects.raw_aggregate([{"$match": {"question_text": "What's up"}}])
65+
66+
The pipeline may also return additional fields that will be added as
67+
annotations on the models::
68+
69+
>>> questions = Question.objects.raw_aggregate([{
70+
... "$project": {
71+
... "question_text": 1,
72+
... "pub_date": 1,
73+
... "year_published": {"$year": "$pub_date"}
74+
... }
75+
... }])
76+
>>> for q in questions:
77+
... print(f"{q.question_text} was published in {q.year_published}.")
78+
...
79+
What's up? was published in 2024.
80+
81+
Fields may also be left out:
82+
83+
>>> Question.objects.raw_aggregate([{"$project": {"question_text": 1}}])
84+
85+
The ``Question`` objects returned by this query will be deferred model instances
86+
(see :meth:`~django.db.models.query.QuerySet.defer()`). This means that the
87+
fields that are omitted from the query will be loaded on demand. For example::
88+
89+
>>> for q in Question.objects.raw_aggregate([{"$project": {"question_text": 1}}]):
90+
>>> print(
91+
... q.question_text, # This will be retrieved by the original query.
92+
... q.pub_date, # This will be retrieved on demand.
93+
... )
94+
...
95+
What's new 2023-09-03 12:00:00+00:00
96+
What's up 2024-08-23 20:57:30+00:00
97+
98+
From outward appearances, this looks like the query has retrieved both the
99+
question text and published date. However, this example actually issued three
100+
queries. Only the question texts were retrieved by the ``raw_aggregate()``
101+
query -- the published dates were both retrieved on demand when they were
102+
printed.

docs/source/ref/utils.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ following parts can be considered stable.
1414

1515
.. function:: parse_uri(uri, db_name=None, test=None)
1616

17-
Parses a MongoDB `connection string`_ into a dictionary suitable for Django's
18-
:setting:`DATABASES` setting.
17+
Parses a MongoDB `connection string`_ into a dictionary suitable for
18+
Django's :setting:`DATABASES` setting.
1919

20-
.. _connection string: https://www.mongodb.com/docs/manual/reference/connection-string/
20+
.. _connection string: https://www.mongodb.com/docs/manual/reference/connection-string/
2121

22-
Example::
22+
Example::
2323

24-
import django_mongodb_backend
24+
import django_mongodb_backend
2525

26-
MONGODB_URI = "mongodb+srv://my_user:[email protected]/defaultauthdb?retryWrites=true&w=majority&tls=false"
27-
DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI, db_name="example")
26+
MONGODB_URI = "mongodb+srv://my_user:[email protected]/defaultauthdb?retryWrites=true&w=majority&tls=false"
27+
DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI, db_name="example")
2828

29-
You must specify ``db_name`` (the :setting:`NAME` of your database) if the URI
30-
doesn't specify ``defaultauthdb``.
29+
You must specify ``db_name`` (the :setting:`NAME` of your database) if the
30+
URI doesn't specify ``defaultauthdb``.
3131

32-
You can use the parameters to customize the resulting :setting:`DATABASES`
33-
setting:
32+
You can use the parameters to customize the resulting :setting:`DATABASES`
33+
setting:
3434

35-
- Use ``test`` to provide a dictionary of settings for test databases in the
36-
format of :setting:`TEST <DATABASE-TEST>`.
35+
- Use ``test`` to provide a dictionary of settings for test databases in
36+
the format of :setting:`TEST <DATABASE-TEST>`.
3737

38-
But for maximum flexibility, construct :setting:`DATABASES` manually as
39-
described in :ref:`configuring-databases-setting`.
38+
But for maximum flexibility, construct :setting:`DATABASES` manually as
39+
described in :ref:`configuring-databases-setting`.

0 commit comments

Comments
 (0)