MCPcopy
hub / github.com/django/django / fetch

Method fetch

django/db/models/fetch_modes.py:31–40  ·  view source on GitHub ↗
(self, fetcher, instance)

Source from the content-addressed store, hash-verified

29 track_peers = True
30
31 def fetch(self, fetcher, instance):
32 instances = [
33 peer
34 for peer_weakref in instance._state.peers
35 if (peer := peer_weakref()) is not None
36 ]
37 if len(instances) > 1:
38 fetcher.fetch_many(instances)
39 else:
40 fetcher.fetch_one(instance)
41
42 def __reduce__(self):
43 return "FETCH_PEERS"

Callers

nothing calls this directly

Calls 2

fetch_manyMethod · 0.45
fetch_oneMethod · 0.45

Tested by

no test coverage detected