mirror of
https://github.com/django/django.git
synced 2025-07-06 10:49:17 +00:00
queryset-refactor: Made none() a method on Querysets, as the documentation
indicates (it was only added to managers in [4394]. Refs #6177. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c8b33b824b
commit
9f0fb3dcc9
@ -293,6 +293,12 @@ class _QuerySet(object):
|
|||||||
return self._clone(klass=DateQuerySet, setup=True, _field=field,
|
return self._clone(klass=DateQuerySet, setup=True, _field=field,
|
||||||
_kind=kind, _order=order)
|
_kind=kind, _order=order)
|
||||||
|
|
||||||
|
def none(self):
|
||||||
|
"""
|
||||||
|
Returns an empty queryset.
|
||||||
|
"""
|
||||||
|
return self._clone(klass=EmptyQuerySet)
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# PUBLIC METHODS THAT ALTER ATTRIBUTES AND RETURN A NEW QUERYSET #
|
# PUBLIC METHODS THAT ALTER ATTRIBUTES AND RETURN A NEW QUERYSET #
|
||||||
##################################################################
|
##################################################################
|
||||||
|
@ -254,6 +254,8 @@ DoesNotExist: Article matching query does not exist.
|
|||||||
[]
|
[]
|
||||||
>>> Article.objects.none().filter(headline__startswith='Article')
|
>>> Article.objects.none().filter(headline__startswith='Article')
|
||||||
[]
|
[]
|
||||||
|
>>> Article.objects.filter(headline__startswith='Article').none()
|
||||||
|
[]
|
||||||
>>> Article.objects.none().count()
|
>>> Article.objects.none().count()
|
||||||
0
|
0
|
||||||
>>> [article for article in Article.objects.none().iterator()]
|
>>> [article for article in Article.objects.none().iterator()]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user