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:
@@ -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__,
|
||||
|
||||
Reference in New Issue
Block a user