diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2012-10-24 00:04:37 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-01-06 19:18:28 +0200 |
| commit | a2396a4c8f2ccd7f91adee6d8c2e9c31f13f0e3f (patch) | |
| tree | f1f67939a21dbf2ac08db770b9b6776754d05ad9 /docs | |
| parent | a843539af2f557e9bdc71b9b5ef66eabe0e39e3c (diff) | |
Fixed #19173 -- Made EmptyQuerySet a marker class only
The guarantee that no queries will be made when accessing results is
done by new EmptyWhere class which is used for query.where and having.
Thanks to Simon Charette for reviewing and valuable suggestions.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/querysets.txt | 10 | ||||
| -rw-r--r-- | docs/releases/1.6.txt | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index a8e946f8a5..2bbd895fd4 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -593,15 +593,17 @@ none .. method:: none() -Returns an ``EmptyQuerySet`` — a ``QuerySet`` subclass that always evaluates to -an empty list. This can be used in cases where you know that you should return -an empty result set and your caller is expecting a ``QuerySet`` object (instead -of returning an empty list, for example.) +Calling none() will create a queryset that never returns any objects and no +query will be executed when accessing the results. A qs.none() queryset +is an instance of ``EmptyQuerySet``. Examples:: >>> Entry.objects.none() [] + >>> from django.db.models.query import EmptyQuerySet + >>> isinstance(Entry.objects.none(), EmptyQuerySet) + True all ~~~ diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt index 1f57913397..e425036839 100644 --- a/docs/releases/1.6.txt +++ b/docs/releases/1.6.txt @@ -31,6 +31,11 @@ Minor features Backwards incompatible changes in 1.6 ===================================== +* The ``django.db.models.query.EmptyQuerySet`` can't be instantiated any more - + it is only usable as a marker class for checking if + :meth:`~django.db.models.query.QuerySet.none` has been called: + ``isinstance(qs.none(), EmptyQuerySet)`` + .. warning:: In addition to the changes outlined in this section, be sure to review the |
