Fixed #12142 -- EmptyQuerySet.update() no longer updates all rows in the database
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0683a79d0c
commit
cf1b6845d4
|
@ -1089,6 +1089,12 @@ class EmptyQuerySet(QuerySet):
|
|||
"""
|
||||
return self
|
||||
|
||||
def update(self, **kwargs):
|
||||
"""
|
||||
Don't update anything.
|
||||
"""
|
||||
return 0
|
||||
|
||||
# EmptyQuerySet is always an empty result in where-clauses (and similar
|
||||
# situations).
|
||||
value_annotation = False
|
||||
|
|
|
@ -295,6 +295,8 @@ DoesNotExist: Article matching query does not exist.
|
|||
[]
|
||||
>>> Article.objects.none().count()
|
||||
0
|
||||
>>> Article.objects.none().update(headline="This should not take effect")
|
||||
0
|
||||
>>> [article for article in Article.objects.none().iterator()]
|
||||
[]
|
||||
|
||||
|
|
Loading…
Reference in New Issue