mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[1.1.X] Fixed #12142 -- EmptyQuerySet.update() no longer updates all rows in the database
r12171 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12960 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4771790c68
commit
eca89ea9be
@ -948,6 +948,12 @@ class EmptyQuerySet(QuerySet):
|
||||
# (it raises StopIteration immediately).
|
||||
yield iter([]).next()
|
||||
|
||||
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
|
||||
|
@ -279,6 +279,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…
x
Reference in New Issue
Block a user