mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Refs #12203 -- Improved error handling for the case where a user manually specifies an m2m field with an explicit through field. Thanks to dgouldin for the report, and Ramiro Morales for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11737 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dd045aaab5
commit
0aeb1e135d
2 changed files with 16 additions and 2 deletions
|
@ -108,7 +108,18 @@ Exception: <class 'regressiontests.admin_validation.models.TwoAlbumFKAndAnE'> ha
|
|||
|
||||
>>> validate_inline(TwoAlbumFKAndAnEInline, None, Album)
|
||||
|
||||
# Regression test for #12203 -- If the explicitly provided through model
|
||||
# Regression test for #12203 - Fail more gracefully when a M2M field that
|
||||
# specifies the 'through' option is included in the 'fields' ModelAdmin option.
|
||||
|
||||
>>> class BookAdmin(admin.ModelAdmin):
|
||||
... fields = ['authors']
|
||||
|
||||
>>> validate(BookAdmin, Book)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
ImproperlyConfigured: 'BookAdmin.fields' can't include the ManyToManyField field 'authors' because 'authors' manually specifies a 'through' model.
|
||||
|
||||
# Regression test for #12209 -- If the explicitly provided through model
|
||||
# is specified as a string, the admin should still be able use
|
||||
# Model.m2m_field.through
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue