diff options
| author | Stephen Burrows <stephen.r.burrows@gmail.com> | 2014-03-21 00:52:49 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-03-25 07:46:48 -0400 |
| commit | b4f165fe941b1aaca49e417330103a02fecb2e85 (patch) | |
| tree | fb8a7620e0a59096f8293b1256f20118ee999f2e /django | |
| parent | 21eaad68e6f26b9f88437c63d584c0a9fb39c9be (diff) | |
[1.7.x] Fixed #22300 -- Fixed crash in migrations when changing non-relational field to relational.
Backport of 35ed792cf2 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/migrations/autodetector.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index 152fde9660..cbd08cc31d 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -267,7 +267,7 @@ class MigrationAutodetector(object): for rem_app_label, rem_model_name, rem_field_name in (old_fields - new_fields): if rem_app_label == app_label and rem_model_name == model_name: old_field_dec = old_model_state.get_field_by_name(rem_field_name).deconstruct()[1:] - if field.rel and field.rel.to: + if field.rel and field.rel.to and 'to' in old_field_dec[2]: old_rel_to = old_field_dec[2]['to'] if old_rel_to in renamed_models_rel: old_field_dec[2]['to'] = renamed_models_rel[old_rel_to] |
