Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #19717 -- "root qs" references in doc.

  • Loading branch information...
commit 846def1adad702a72c6fbe0b29fc8f39c4ab05e2 1 parent 9c2066d
@jpic authored
Showing with 10 additions and 18 deletions.
  1. +10 −18 docs/topics/db/queries.txt
View
28 docs/topics/db/queries.txt
@@ -162,11 +162,11 @@ default. Access it directly via the model class, like so::
instances, to enforce a separation between "table-level" operations and
"record-level" operations.
-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
-describes all objects in the model's database table. For example,
-``Blog.objects`` is the initial :class:`~django.db.models.query.QuerySet` that
-contains all ``Blog`` objects in the database.
+The :class:`~django.db.models.Manager` is the main
+source of ``QuerySets`` for a model. For example,
+``Blog.objects.all()`` returns a
+:class:`~django.db.models.query.QuerySet` that contains
+all ``Blog`` objects in the database.
Retrieving all objects
----------------------
@@ -180,18 +180,11 @@ this, use the :meth:`~django.db.models.query.QuerySet.all` method on 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.
-(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
----------------------------------------
-The root :class:`~django.db.models.query.QuerySet` provided by the
-:class:`~django.db.models.Manager` describes all objects in the database
+The :class:`~django.db.models.query.QuerySet` returned by
+:meth:`~django.db.models.Manager.all` describes all objects in the database
table. Usually, though, you'll need to select only a subset of the complete set
of objects.
@@ -215,11 +208,10 @@ from the year 2006, use :meth:`~django.db.models.query.QuerySet.filter` like
so::
Entry.objects.filter(pub_date__year=2006)
+
+With the default manager class, it is the same as::
-We don't have to add an :meth:`~django.db.models.query.QuerySet.all` --
-``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
-root :class:`~django.db.models.query.QuerySet`.
+ Entry.objects.all().filter(pub_date__year=2006)
.. _chaining-filters:
Please sign in to comment.
Something went wrong with that request. Please try again.