Return a copy of the current QuerySet. A lightweight alternative to deepcopy().
(self)
| 2215 | return obj |
| 2216 | |
| 2217 | def _clone(self): |
| 2218 | """ |
| 2219 | Return a copy of the current QuerySet. A lightweight alternative |
| 2220 | to deepcopy(). |
| 2221 | """ |
| 2222 | c = self.__class__( |
| 2223 | model=self.model, |
| 2224 | query=self.query.chain(), |
| 2225 | using=self._db, |
| 2226 | hints=self._hints, |
| 2227 | ) |
| 2228 | c._sticky_filter = self._sticky_filter |
| 2229 | c._for_write = self._for_write |
| 2230 | c._prefetch_related_lookups = self._prefetch_related_lookups[:] |
| 2231 | c._known_related_objects = self._known_related_objects |
| 2232 | c._iterable_class = self._iterable_class |
| 2233 | c._fetch_mode = self._fetch_mode |
| 2234 | c._fields = self._fields |
| 2235 | return c |
| 2236 | |
| 2237 | def _fetch_all(self): |
| 2238 | if self._result_cache is None: |