Count the selected elements in the query. :param with_limit_and_skip (optional): take any :meth:`limit` or :meth:`skip` that has been applied to this cursor into account when getting the count
(self, with_limit_and_skip=False)
| 133 | self._has_more = False |
| 134 | |
| 135 | def count(self, with_limit_and_skip=False): |
| 136 | """Count the selected elements in the query. |
| 137 | |
| 138 | :param with_limit_and_skip (optional): take any :meth:`limit` or |
| 139 | :meth:`skip` that has been applied to this cursor into account when |
| 140 | getting the count |
| 141 | """ |
| 142 | if with_limit_and_skip is False: |
| 143 | return super().count(with_limit_and_skip) |
| 144 | |
| 145 | if self._len is None: |
| 146 | # cache the length |
| 147 | self._len = super().count(with_limit_and_skip) |
| 148 | |
| 149 | return self._len |
| 150 | |
| 151 | def no_cache(self): |
| 152 | """Convert to a non-caching queryset""" |
no outgoing calls