Code

Ticket #12143: m2m_fix.diff

File m2m_fix.diff, 620 bytes (added by Alex, 5 years ago)

Can you confirm whether this fixes the issue for you?

Line 
1diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
2index 2f1193f..e8a4b98 100644
3--- a/django/db/models/fields/related.py
4+++ b/django/db/models/fields/related.py
5@@ -819,7 +819,7 @@ def create_many_to_many_intermediary_model(field, klass):
6     name = '%s_%s' % (klass._meta.object_name, field.name)
7     if field.rel.to == RECURSIVE_RELATIONSHIP_CONSTANT or field.rel.to == klass._meta.object_name:
8         from_ = 'from_%s' % to.lower()
9-        to = to.lower()
10+        to = 'to_%s' % to.lower()
11     else:
12         from_ = klass._meta.object_name.lower()
13         to = to.lower()