1
0
mirror of https://github.com/django/django.git synced 2025-10-29 08:36:09 +00:00

Improve migration optimizer to be able to optimize through other ops

This commit is contained in:
Andrew Godwin
2013-10-16 11:09:33 +01:00
parent 694d7da6c5
commit 42f8666f6a
4 changed files with 124 additions and 5 deletions

View File

@@ -64,6 +64,18 @@ class Operation(object):
"""
return "%s: %s" % (self.__class__.__name__, self._constructor_args)
def references_model(self, name, app_label=None):
"""
Returns True if there is a chance this operation references the given
model name (as a string), with an optional app label for accuracy.
Used for optimization. If in doubt, return True;
returning a false positive will merely make the optimizer a little
less efficient, while returning a false negative may result in an
unusable optimized migration.
"""
return True
def __repr__(self):
return "<%s %s%s>" % (
self.__class__.__name__,