Commit eca89ea9 authored by Karen Tracey's avatar Karen Tracey
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
parent 4771790c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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()]
[]