Refs #32528 -- Simplified MigrationAutodetector._sort_migrations().

This commit is contained in:
Nick Pope 2021-03-08 13:36:14 +00:00 committed by Mariusz Felisiak
parent 1e62a64202
commit 39f83765e1
1 changed files with 3 additions and 4 deletions

View File

@ -391,10 +391,9 @@ class MigrationAutodetector:
# Resolve intra-app dependencies to handle circular # Resolve intra-app dependencies to handle circular
# references involving a swappable model. # references involving a swappable model.
dep = self._resolve_dependency(dep)[0] dep = self._resolve_dependency(dep)[0]
if dep[0] == app_label: if dep[0] != app_label:
for op2 in ops: continue
if self.check_dependency(op2, dep): ts.add(op, *(x for x in ops if self.check_dependency(x, dep)))
ts.add(op, op2)
self.generated_operations[app_label] = list(ts.static_order()) self.generated_operations[app_label] = list(ts.static_order())
def _optimize_migrations(self): def _optimize_migrations(self):