summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-11-13 12:35:05 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-11-13 12:35:05 +0000
commit0aeb1e135d88dc690e34b40cf621d5fc4d34be4a (patch)
tree95247d3fbd1377bc99d49d69cd7e68d2ebcb7396 /tests/regressiontests
parentdd045aaab5cb5c5e04c5fafc62913acccf7029b3 (diff)
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
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/admin_validation/models.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/regressiontests/admin_validation/models.py b/tests/regressiontests/admin_validation/models.py
index 93e3e065e6..924cf69d4d 100644
--- a/tests/regressiontests/admin_validation/models.py
+++ b/tests/regressiontests/admin_validation/models.py
@@ -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