Changeset 7938
- Timestamp:
- 07/16/08 18:17:29 (4 months ago)
- Files:
-
- django/trunk/django/db/models/query.py (modified) (1 diff)
- django/trunk/tests/regressiontests/queries/models.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/query.py
r7912 r7938 281 281 integer. 282 282 283 If the QuerySet is already cached (i.e. self._result_cache is set) this 284 simply returns the length of the cached results set to avoid multiple 285 SELECT COUNT(*) calls. 286 """ 287 if self._result_cache is not None: 283 If the QuerySet is already fully cached this simply returns the length 284 of the cached results set to avoid multiple SELECT COUNT(*) calls. 285 """ 286 if self._result_cache is not None and not self._iter: 288 287 return len(self._result_cache) 289 288 django/trunk/tests/regressiontests/queries/models.py
r7926 r7938 831 831 ... if i > 10: break 832 832 833 Bug #7759 -- count should work with a partially read result set. 834 >>> count = Number.objects.count() 835 >>> qs = Number.objects.all() 836 >>> for obj in qs: 837 ... qs.count() == count 838 ... break 839 True 840 833 841 """} 834 842
