Replaced Operation._get_model_tuple() by ModelTuple.from_model().
This method predated the introduction of ModelTuple and had a single use.
This commit is contained in:
parent
8069526ce3
commit
5ca5178a78
|
@ -1,5 +1,4 @@
|
|||
from django.db import router
|
||||
from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT
|
||||
|
||||
|
||||
class Operation:
|
||||
|
@ -125,14 +124,6 @@ class Operation:
|
|||
return [self]
|
||||
return False
|
||||
|
||||
def _get_model_tuple(self, remote_model, app_label, model_name):
|
||||
if remote_model == RECURSIVE_RELATIONSHIP_CONSTANT:
|
||||
return app_label, model_name.lower()
|
||||
elif '.' in remote_model:
|
||||
return tuple(remote_model.lower().split('.'))
|
||||
else:
|
||||
return app_label, remote_model.lower()
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s %s%s>" % (
|
||||
self.__class__.__name__,
|
||||
|
|
|
@ -339,7 +339,7 @@ class RenameField(FieldOperation):
|
|||
for index, (name, field) in enumerate(model_state.fields):
|
||||
remote_field = field.remote_field
|
||||
if remote_field:
|
||||
remote_model_tuple = self._get_model_tuple(
|
||||
remote_model_tuple = ModelTuple.from_model(
|
||||
remote_field.model, model_app_label, model_name
|
||||
)
|
||||
if remote_model_tuple == model_tuple:
|
||||
|
|
Loading…
Reference in New Issue