Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #6899 -- Fixed a problem with boolean evaluation of empty query…


Based on patches from and brodie.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ed23f00a0007116a695adadc53d642ab90823823 1 parent cfb7063
@malcolmt malcolmt authored
3  django/db/models/
@@ -72,7 +72,8 @@ def __nonzero__(self):
except StopIteration:
return False
- return True
+ return True
+ return bool(self._result_cache)
def __getitem__(self, k):
"Retrieve an item or slice from the set of results."
6 tests/regressiontests/queries/
@@ -584,6 +584,12 @@ class Meta:
<Tag: t3>
+>>> qs = X.objects.all()
+>>> bool(qs)
+>>> bool(qs)
We can do slicing beyond what is currently in the result cache, too.
# FIXME!! This next test causes really weird PostgreSQL behaviour, but it's
Please sign in to comment.
Something went wrong with that request. Please try again.