mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #29337 -- Added __len__() & __bool__() to RawQuerySet.
This commit is contained in:
parent
ec0319ff82
commit
f2026ca5e2
3 changed files with 16 additions and 8 deletions
|
@ -1293,6 +1293,14 @@ class RawQuerySet:
|
|||
if self._result_cache is None:
|
||||
self._result_cache = list(self.iterator())
|
||||
|
||||
def __len__(self):
|
||||
self._fetch_all()
|
||||
return len(self._result_cache)
|
||||
|
||||
def __bool__(self):
|
||||
self._fetch_all()
|
||||
return bool(self._result_cache)
|
||||
|
||||
def __iter__(self):
|
||||
self._fetch_all()
|
||||
return iter(self._result_cache)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue