Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[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
  • Loading branch information...
commit eca89ea9be1530105e0d390ac381230184664c0a 1 parent 4771790
@kmtracey kmtracey authored
Showing with 8 additions and 0 deletions.
  1. +6 −0 django/db/models/query.py
  2. +2 −0  tests/modeltests/lookup/models.py
View
6 django/db/models/query.py
@@ -948,6 +948,12 @@ def iterator(self):
# (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
View
2  tests/modeltests/lookup/models.py
@@ -279,6 +279,8 @@ def __unicode__(self):
[]
>>> Article.objects.none().count()
0
+>>> Article.objects.none().update(headline="This should not take effect")
+0
>>> [article for article in Article.objects.none().iterator()]
[]
Please sign in to comment.
Something went wrong with that request. Please try again.