1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #23244: Error altering FK to non-FK in migrations

This commit is contained in:
Andrew Godwin
2014-08-07 11:52:03 +10:00
parent 938da36cb1
commit dfe86449c9
2 changed files with 28 additions and 4 deletions

View File

@@ -126,7 +126,7 @@ class AlterField(Operation):
if from_field.rel and from_field.rel.to:
if isinstance(from_field.rel.to, six.string_types):
from_field.rel.to = to_field.rel.to
elif isinstance(to_field.rel.to, six.string_types):
elif to_field.rel and isinstance(to_field.rel.to, six.string_types):
to_field.rel.to = from_field.rel.to
schema_editor.alter_field(from_model, from_field, to_field)