Fixed #20625 -- Chainable Manager/QuerySet methods.

Additionally this patch solves the orthogonal problem that specialized
`QuerySet` like `ValuesQuerySet` didn't inherit from the current `QuerySet`
type. This wasn't an issue until now because we didn't officially support
custom `QuerySet` but it became necessary with the introduction of this new
feature.

Thanks aaugustin, akaariai, carljm, charettes, mjtamlyn, shaib and timgraham
for the reviews.
This commit is contained in:
Loic Bistuer 2013-07-26 11:59:40 +03:00 committed by Anssi Kääriäinen
parent 8f3aefdec3
commit 31fadc1202
10 changed files with 390 additions and 127 deletions

View file

@ -121,9 +121,7 @@ described here.
QuerySet API
============
Though you usually won't create one manually — you'll go through a
:class:`~django.db.models.Manager` — here's the formal declaration of a
``QuerySet``:
Here's the formal declaration of a ``QuerySet``:
.. class:: QuerySet([model=None, query=None, using=None])
@ -1866,6 +1864,17 @@ DO_NOTHING do not prevent taking the fast-path in deletion.
Note that the queries generated in object deletion is an implementation
detail subject to change.
as_manager
~~~~~~~~~~
.. classmethod:: as_manager()
.. versionadded:: 1.7
Class method that returns an instance of :class:`~django.db.models.Manager`
with a copy of the ``QuerySet``'s methods. See
:ref:`create-manager-with-queryset-methods` for more details.
.. _field-lookups:
Field lookups