Skip to content

Commit 9ffb0cc

Browse files
committed
Fix doc
1 parent fedce2b commit 9ffb0cc

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

docs/source/ref/models/fields.rst

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,14 @@ These indexes use 0-based indexing.
302302
Querying ``EmbeddedModelArrayField``
303303
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
304304

305-
There are a number of custom lookups and a transform for :class:`EmbeddedModelArrayField`, similar to those available for :class:`ArrayField`.
305+
There are a number of custom lookups and a transform for
306+
:class:`EmbeddedModelArrayField`, similar to those available
307+
for :class:`ArrayField`.
306308
We will use the following example model::
307309

308310
from django.db import models
309-
from django_mongodb_backend.fields import EmbeddedModelArrayField, EmbeddedModelField,
311+
from django_mongodb_backend.fields import EmbeddedModelArrayField
312+
310313

311314
class Tag(EmbeddedModel):
312315
label = models.CharField(max_length=100)
@@ -323,7 +326,8 @@ We will use the following example model::
323326
``overlap``
324327
^^^^^^^^^^^
325328

326-
Returns objects where any of the embedded documents in the field match any of the values passed. For example:
329+
Returns objects where any of the embedded documents in the field match any of
330+
the values passed. For example:
327331

328332
.. code-block:: pycon
329333
@@ -346,7 +350,8 @@ Returns objects where any of the embedded documents in the field match any of th
346350
``len``
347351
^^^^^^^
348352

349-
Returns the length of the embedded model array. The lookups available afterward are those available for :class:`~django.db.models.IntegerField`. For example:
353+
Returns the length of the embedded model array. The lookups available afterward
354+
are those available for :class:`~django.db.models.IntegerField`. For example:
350355

351356
.. code-block:: pycon
352357
@@ -363,7 +368,8 @@ Returns the length of the embedded model array. The lookups available afterward
363368
``exact``
364369
^^^^^^^^^
365370

366-
Returns objects where **any** embedded model in the array exactly matches the given value. This acts like an existence filter on matching embedded documents.
371+
Returns objects where **any** embedded model in the array exactly matches the
372+
given value. This acts like an existence filter on matching embedded documents.
367373

368374
.. code-block:: pycon
369375
@@ -375,12 +381,15 @@ Returns objects where **any** embedded model in the array exactly matches the gi
375381
>>> Post.objects.filter(tags__label__exact="tutorial")
376382
<QuerySet [<Post: Second post>]>
377383
378-
Note that this does **not** require the whole array to match, only that at least one embedded document matches exactly.
384+
Note that this does **not** require the whole array to match, only that at
385+
least one embedded document matches exactly.
379386

380387
Keytransforms
381388
^^^^^^^^^^^^^
382389

383-
Key transforms for \:class:`EmbeddedModelArrayField` allow querying fields of the embedded model. The transform checks if **any** element in the array has a field matching the condition, similar to MongoDB behavior. For example:
390+
Key transforms for :class:`EmbeddedModelArrayField` allow querying fields of
391+
the embedded model. The transform checks if **any** element in the array has a
392+
field matching the condition, similar to MongoDB behavior. For example:
384393

385394
.. code-block:: pycon
386395
@@ -396,12 +405,11 @@ Key transforms for \:class:`EmbeddedModelArrayField` allow querying fields of th
396405
>>> Post.objects.filter(tags__label="django")
397406
<QuerySet [<Post: First post>, <Post: Third post>]>
398407
399-
400408
Transforms can be chained:
401409

402410
.. code-block:: pycon
403411
404-
>>> Post.objects.filter(tags__label__icontains="djan")
412+
>>> Post.objects.filter(tags__label__overlap=["django"])
405413
<QuerySet [<Post: First post>, <Post: Third post>]>
406414
407415

0 commit comments

Comments
 (0)