diff options
| author | Markus Holtermann <info@markusholtermann.eu> | 2014-12-30 02:52:32 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-01-02 15:37:09 +0100 |
| commit | 057305e588ac90474fef47e2fb2890552a543731 (patch) | |
| tree | 53eb239b22580bfe8d60a5294f877ab776c6063e | |
| parent | a159b1facd222c20dde12f1e0117643af528d511 (diff) | |
Added ignore_swappable to StateApps
Refs #23745.
| -rw-r--r-- | django/db/migrations/autodetector.py | 2 | ||||
| -rw-r--r-- | django/db/migrations/state.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index d96f09b0be..e3dd87e3bd 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -108,7 +108,7 @@ class MigrationAutodetector(object): # Prepare some old/new state and model lists, separating # proxy models and ignoring unmigrated apps. - self.old_apps = self.from_state.apps + self.old_apps = self.from_state.concrete_apps self.new_apps = self.to_state.apps self.old_model_keys = [] self.old_proxy_keys = [] diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py index f2267b3536..8898fc4e9a 100644 --- a/django/db/migrations/state.py +++ b/django/db/migrations/state.py @@ -44,6 +44,11 @@ class ProjectState(object): def apps(self): return StateApps(self.real_apps, self.models) + @property + def concrete_apps(self): + self.apps = StateApps(self.real_apps, self.models, ignore_swappable=True) + return self.apps + @classmethod def from_apps(cls, apps): "Takes in an Apps and returns a ProjectState matching it" @@ -87,7 +92,7 @@ class StateApps(Apps): Subclass of the global Apps registry class to better handle dynamic model additions and removals. """ - def __init__(self, real_apps, models): + def __init__(self, real_apps, models, ignore_swappable=False): # Any apps in self.real_apps should have all their models included # in the render. We don't use the original model instances as there # are some variables that refer to the Apps object. |
