Fixed #29337 -- Added __len__() & __bool__() to RawQuerySet.

This commit is contained in:
Adnan Umer 2018-04-19 15:09:54 +05:00 committed by Tim Graham
parent ec0319ff82
commit f2026ca5e2
3 changed files with 16 additions and 8 deletions

View file

@ -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)