Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow retrieval of project state at start of migrations

  • Loading branch information...
commit dfa7c5cade318ce113a95e12cae47c446604e993 1 parent 05929ee
@andrewgodwin andrewgodwin authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/db/migrations/graph.py
View
5 django/db/migrations/graph.py
@@ -120,11 +120,14 @@ def _dfs(start, get_children, path):
def __str__(self):
return "Graph: %s nodes, %s edges" % (len(self.nodes), sum(len(x) for x in self.dependencies.values()))
- def project_state(self, node):
+ def project_state(self, node, at_end=True):
"""
Given a migration node, returns a complete ProjectState for it.
+ If at_end is False, returns the state before the migration has run.
"""
plan = self.forwards_plan(node)
+ if not at_end:
+ plan = plan[:-1]
project_state = ProjectState()
for node in plan:
project_state = self.nodes[node].mutate_state(project_state)

0 comments on commit dfa7c5c

Please sign in to comment.
Something went wrong with that request. Please try again.