MCPcopy
hub / github.com/django/django / make_state

Method make_state

django/db/migrations/graph.py:316–333  ·  view source on GitHub ↗

Given a migration node or nodes, return a complete ProjectState for it. If at_end is False, return the state before the migration has run. If nodes is not provided, return the overall most current project state.

(self, nodes=None, at_end=True, real_apps=None)

Source from the content-addressed store, hash-verified

314 return list(plan)
315
316 def make_state(self, nodes=None, at_end=True, real_apps=None):
317 """
318 Given a migration node or nodes, return a complete ProjectState for it.
319 If at_end is False, return the state before the migration has run.
320 If nodes is not provided, return the overall most current project
321 state.
322 """
323 if nodes is None:
324 nodes = list(self.leaf_nodes())
325 if not nodes:
326 return ProjectState()
327 if not isinstance(nodes[0], tuple):
328 nodes = [nodes]
329 plan = self._generate_plan(nodes, at_end)
330 project_state = ProjectState(real_apps=real_apps)
331 for node in plan:
332 project_state = self.nodes[node].mutate_state(project_state, preserve=False)
333 return project_state
334
335 def __contains__(self, node):
336 return node in self.nodes

Callers 1

project_stateMethod · 0.80

Calls 4

leaf_nodesMethod · 0.95
_generate_planMethod · 0.95
ProjectStateClass · 0.90
mutate_stateMethod · 0.80

Tested by

no test coverage detected