diff options
Diffstat (limited to 'docs/topics/db')
| -rw-r--r-- | docs/topics/db/examples/many_to_many.txt | 26 | ||||
| -rw-r--r-- | docs/topics/db/optimization.txt | 4 | ||||
| -rw-r--r-- | docs/topics/db/queries.txt | 4 |
3 files changed, 17 insertions, 17 deletions
diff --git a/docs/topics/db/examples/many_to_many.txt b/docs/topics/db/examples/many_to_many.txt index 752abe9f72..f53f3c131a 100644 --- a/docs/topics/db/examples/many_to_many.txt +++ b/docs/topics/db/examples/many_to_many.txt @@ -47,14 +47,14 @@ Create a few ``Publications``:: Create an ``Article``:: - >>> a1 = Article(headline='Django lets you build Web apps easily') + >>> a1 = Article(headline='Django lets you build web apps easily') You can't associate it with a ``Publication`` until it's been saved:: >>> a1.publications.add(p1) Traceback (most recent call last): ... - ValueError: "<Article: Django lets you build Web apps easily>" needs to have a value for field "id" before this many-to-many relationship can be used. + ValueError: "<Article: Django lets you build web apps easily>" needs to have a value for field "id" before this many-to-many relationship can be used. Save it! :: @@ -100,7 +100,7 @@ Create and add a ``Publication`` to an ``Article`` in one step using >>> p2.article_set.all() <QuerySet [<Article: NASA uses Python>]> >>> p1.article_set.all() - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA uses Python>]> >>> Publication.objects.get(id=4).article_set.all() <QuerySet [<Article: NASA uses Python>]> @@ -108,13 +108,13 @@ Many-to-many relationships can be queried using :ref:`lookups across relationships <lookups-that-span-relationships>`:: >>> Article.objects.filter(publications__id=1) - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA uses Python>]> >>> Article.objects.filter(publications__pk=1) - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA uses Python>]> >>> Article.objects.filter(publications=1) - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA uses Python>]> >>> Article.objects.filter(publications=p1) - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA uses Python>]> >>> Article.objects.filter(publications__title__startswith="Science") <QuerySet [<Article: NASA uses Python>, <Article: NASA uses Python>]> @@ -132,9 +132,9 @@ The :meth:`~django.db.models.query.QuerySet.count` function respects 1 >>> Article.objects.filter(publications__in=[1,2]).distinct() - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA uses Python>]> >>> Article.objects.filter(publications__in=[p1,p2]).distinct() - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA uses Python>]> Reverse m2m queries are supported (i.e., starting at the table that doesn't have a :class:`~django.db.models.ManyToManyField`):: @@ -165,7 +165,7 @@ Excluding a related item works as you would expect, too (although the SQL involved is a little complex):: >>> Article.objects.exclude(publications=p2) - <QuerySet [<Article: Django lets you build Web apps easily>]> + <QuerySet [<Article: Django lets you build web apps easily>]> If we delete a ``Publication``, its ``Articles`` won't be able to access it:: @@ -180,7 +180,7 @@ If we delete an ``Article``, its ``Publications`` won't be able to access it:: >>> a2.delete() >>> Article.objects.all() - <QuerySet [<Article: Django lets you build Web apps easily>]> + <QuerySet [<Article: Django lets you build web apps easily>]> >>> p2.article_set.all() <QuerySet []> @@ -261,7 +261,7 @@ go:: >>> Publication.objects.all() <QuerySet [<Publication: Highlights for Children>, <Publication: The Python Journal>]> >>> Article.objects.all() - <QuerySet [<Article: Django lets you build Web apps easily>, <Article: NASA finds intelligent life on Earth>, <Article: NASA uses Python>, <Article: Oxygen-free diet works wonders>]> + <QuerySet [<Article: Django lets you build web apps easily>, <Article: NASA finds intelligent life on Earth>, <Article: NASA uses Python>, <Article: Oxygen-free diet works wonders>]> >>> a2.publications.all() <QuerySet [<Publication: The Python Journal>]> @@ -269,7 +269,7 @@ Bulk delete some articles - references to deleted objects should go:: >>> q = Article.objects.filter(headline__startswith='Django') >>> print(q) - <QuerySet [<Article: Django lets you build Web apps easily>]> + <QuerySet [<Article: Django lets you build web apps easily>]> >>> q.delete() After the :meth:`~django.db.models.query.QuerySet.delete`, the diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt index 180cd60a46..c9a0396b89 100644 --- a/docs/topics/db/optimization.txt +++ b/docs/topics/db/optimization.txt @@ -81,7 +81,7 @@ Understand cached attributes As well as caching of the whole ``QuerySet``, there is caching of the result of attributes on ORM objects. In general, attributes that are not callable will be -cached. For example, assuming the :ref:`example Weblog models +cached. For example, assuming the :ref:`example blog models <queryset-model-example>`:: >>> entry = Entry.objects.get(id=1) @@ -164,7 +164,7 @@ First, the query will be quicker because of the underlying database index. Also, the query could run much slower if multiple objects match the lookup; having a unique constraint on the column guarantees this will never happen. -So using the :ref:`example Weblog models <queryset-model-example>`:: +So using the :ref:`example blog models <queryset-model-example>`:: >>> entry = Entry.objects.get(id=10) diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index f06dd21680..ac425e99f4 100644 --- a/docs/topics/db/queries.txt +++ b/docs/topics/db/queries.txt @@ -11,7 +11,7 @@ API. Refer to the :doc:`data model reference </ref/models/index>` for full details of all the various model lookup options. Throughout this guide (and in the reference), we'll refer to the following -models, which comprise a Weblog application: +models, which comprise a blog application: .. _queryset-model-example: @@ -1181,7 +1181,7 @@ object and returns the number of objects deleted and a dictionary with the number of deletions per object type. Example:: >>> e.delete() - (1, {'weblog.Entry': 1}) + (1, {'blog.Entry': 1}) You can also delete objects in bulk. Every :class:`~django.db.models.query.QuerySet` has a |
