MCPcopy
hub / github.com/django/django / defer

Method defer

django/db/models/query.py:1933–1948  ·  view source on GitHub ↗

Defer the loading of data for certain fields until they are accessed. Add the set of deferred fields to any existing set of deferred fields. The only exception to this is if None is passed in as the only parameter, in which case remove all deferrals.

(self, *fields)

Source from the content-addressed store, hash-verified

1931 return clone
1932
1933 def defer(self, *fields):
1934 """
1935 Defer the loading of data for certain fields until they are accessed.
1936 Add the set of deferred fields to any existing set of deferred fields.
1937 The only exception to this is if None is passed in as the only
1938 parameter, in which case remove all deferrals.
1939 """
1940 self._not_support_combined_queries("defer")
1941 if self._fields is not None:
1942 raise TypeError("Cannot call defer() after .values() or .values_list()")
1943 clone = self._chain()
1944 if fields == (None,):
1945 clone.query.clear_deferred_loading()
1946 else:
1947 clone.query.add_deferred_loading(fields)
1948 return clone
1949
1950 def only(self, *fields):
1951 """

Calls 4

_chainMethod · 0.95
add_deferred_loadingMethod · 0.80