1
0
mirror of https://github.com/django/django.git synced 2025-10-28 16:16:12 +00:00

Fixed #22853: Swapped models are now ignored for migration operations.

This commit is contained in:
Andrew Godwin
2014-06-17 17:45:38 -07:00
parent 91f1b6dcdc
commit 8d2ac948a9
6 changed files with 147 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
from __future__ import unicode_literals
from django.db import router
class Operation(object):
@@ -97,6 +98,17 @@ class Operation(object):
"""
return self.references_model(model_name, app_label)
def allowed_to_migrate(self, connection_alias, model):
"""
Returns if we're allowed to migrate the model. Checks the router,
if it's a proxy, and if it's swapped out.
"""
return (
router.allow_migrate(connection_alias, model) and
not model._meta.proxy and
not model._meta.swapped
)
def __repr__(self):
return "<%s %s%s>" % (
self.__class__.__name__,