Skip to content

Commit

Permalink
[1.5.X] Fixed #19717 - Removed mentions of "root QuerySet" in docs.
Browse files Browse the repository at this point in the history
Thanks julien.aubert.mail@ for the report and James Pic for the patch.

Backport of 64d0f89 from master
  • Loading branch information
timgraham committed Feb 18, 2013
1 parent 94ef17e commit 5d853db
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions docs/topics/db/queries.txt
Expand Up @@ -163,10 +163,9 @@ default. Access it directly via the model class, like so::
"record-level" operations. "record-level" operations.


The :class:`~django.db.models.Manager` is the main source of ``QuerySets`` for The :class:`~django.db.models.Manager` is the main source of ``QuerySets`` for
a model. It acts as a "root" :class:`~django.db.models.query.QuerySet` that a model. For example, ``Blog.objects.all()`` returns a
describes all objects in the model's database table. For example, :class:`~django.db.models.query.QuerySet` that contains all ``Blog`` objects in
``Blog.objects`` is the initial :class:`~django.db.models.query.QuerySet` that the database.
contains all ``Blog`` objects in the database.


Retrieving all objects Retrieving all objects
---------------------- ----------------------
Expand All @@ -180,20 +179,13 @@ this, use the :meth:`~django.db.models.query.QuerySet.all` method on a
The :meth:`~django.db.models.query.QuerySet.all` method returns a The :meth:`~django.db.models.query.QuerySet.all` method returns a
:class:`~django.db.models.query.QuerySet` of all the objects in the database. :class:`~django.db.models.query.QuerySet` of all the objects in the database.


(If ``Entry.objects`` is a :class:`~django.db.models.query.QuerySet`, why can't
we just do ``Entry.objects``? That's because ``Entry.objects``, the root
:class:`~django.db.models.query.QuerySet`, is a special case that cannot be
evaluated. The :meth:`~django.db.models.query.QuerySet.all` method returns a
:class:`~django.db.models.query.QuerySet` that *can* be evaluated.)


Retrieving specific objects with filters Retrieving specific objects with filters
---------------------------------------- ----------------------------------------


The root :class:`~django.db.models.query.QuerySet` provided by the The :class:`~django.db.models.query.QuerySet` returned by
:class:`~django.db.models.Manager` describes all objects in the database :meth:`~django.db.models.query.QuerySet.all` describes all objects in the
table. Usually, though, you'll need to select only a subset of the complete set database table. Usually, though, you'll need to select only a subset of the
of objects. complete set of objects.


To create such a subset, you refine the initial To create such a subset, you refine the initial
:class:`~django.db.models.query.QuerySet`, adding filter conditions. The two :class:`~django.db.models.query.QuerySet`, adding filter conditions. The two
Expand All @@ -216,10 +208,9 @@ so::


Entry.objects.filter(pub_date__year=2006) Entry.objects.filter(pub_date__year=2006)


We don't have to add an :meth:`~django.db.models.query.QuerySet.all` -- With the default manager class, it is the same as::
``Entry.objects.all().filter(...)``. That would still work, but you only need
:meth:`~django.db.models.query.QuerySet.all` when you want all objects from the Entry.objects.all().filter(pub_date__year=2006)
root :class:`~django.db.models.query.QuerySet`.


.. _chaining-filters: .. _chaining-filters:


Expand Down

0 comments on commit 5d853db

Please sign in to comment.