MCPcopy
hub / github.com/django/django / construct_managers

Method construct_managers

django/db/migrations/state.py:934–945  ·  view source on GitHub ↗

Deep-clone the managers using deconstruction.

(self)

Source from the content-addressed store, hash-verified

932 )
933
934 def construct_managers(self):
935 """Deep-clone the managers using deconstruction."""
936 # Sort all managers by their creation counter
937 sorted_managers = sorted(self.managers, key=lambda v: v[1].creation_counter)
938 for mgr_name, manager in sorted_managers:
939 as_manager, manager_path, qs_path, args, kwargs = manager.deconstruct()
940 if as_manager:
941 qs_class = import_string(qs_path)
942 yield mgr_name, qs_class.as_manager()
943 else:
944 manager_class = import_string(manager_path)
945 yield mgr_name, manager_class(*args, **kwargs)
946
947 def clone(self):
948 """Return an exact copy of this ModelState."""

Callers 1

renderMethod · 0.95

Calls 3

import_stringFunction · 0.90
as_managerMethod · 0.80
deconstructMethod · 0.45

Tested by

no test coverage detected