diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2012-09-24 13:17:38 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2012-09-24 13:17:38 +0100 |
| commit | 3a338d00ec0d32d54faa0bf88409d02638eae60d (patch) | |
| tree | 8d4e3b55f352e48e83acf42aa985156f5f6c509c | |
| parent | 49dc1e7d28477534daa61a34df2f0308742287e4 (diff) | |
Add comment to usage of m2m_reverse_field_name
| -rw-r--r-- | django/db/backends/schema.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py index 960fd7035d..5a5932abeb 100644 --- a/django/db/backends/schema.py +++ b/django/db/backends/schema.py @@ -591,6 +591,8 @@ class BaseDatabaseSchemaEditor(object): # Repoint the FK to the other side self.alter_field( new_field.rel.through, + # We need the field that points to the target model, so we can tell alter_field to change it - + # this is m2m_reverse_field_name() (as opposed to m2m_field_name, which points to our model) old_field.rel.through._meta.get_field_by_name(old_field.m2m_reverse_field_name())[0], new_field.rel.through._meta.get_field_by_name(new_field.m2m_reverse_field_name())[0], ) |
