commit bef6e3794e6e29806675e8c4aea3f3f371977ae3
Author: VINAY Kr. SHARMA <sharma_salient@hotmail.com>
Date: Mon Jun 23 14:38:08 2014 +0530
Fixed: #12203 ManyToManyField with explicit through model can't be used as an admin field
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py
index 3350625..4f51cfb 100644
a
|
b
|
class BaseModelAdminChecks(object):
|
177 | 177 | return [] |
178 | 178 | else: |
179 | 179 | if (isinstance(field, models.ManyToManyField) and |
180 | | not field.rel.through._meta.auto_created): |
| 180 | not field.rel.through._meta.auto_created) and field.rel.through_fields is None: |
| 181 | """ If user has defined through fields then return with no error """ |
181 | 182 | return [ |
182 | 183 | checks.Error( |
183 | 184 | ("The value of '%s' cannot include the ManyToManyField '%s', " |
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index e01cdd0..c178a8a 100644
a
|
b
|
class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)):
|
262 | 262 | """ |
263 | 263 | # If it uses an intermediary model that isn't auto created, don't show |
264 | 264 | # a field in admin. |
265 | | if not db_field.rel.through._meta.auto_created: |
| 265 | if not db_field.rel.through._meta.auto_created and db_field.rel.through_fields is None: |
266 | 266 | return None |
267 | 267 | db = kwargs.get('using') |
268 | 268 | |