summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrian Rosner <brosner@gmail.com>2008-09-02 17:26:24 +0000
committerBrian Rosner <brosner@gmail.com>2008-09-02 17:26:24 +0000
commitc1de41f4d29d15616075ffd474e3aba7adcfc64f (patch)
treef00fbc0995eb98d62438b58ae223d2b84cc0c2f3 /tests
parent326b26656aa3770be99da88dd76e7eb9c73d1dc5 (diff)
Fixed #7973 -- Added exclude to BaseModelAdmin to make everything consistent with the form/formset factories. Refs #8071 to make it easier to get at exclude. Thanks julien for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8861 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/model_formsets/models.py1
-rw-r--r--tests/regressiontests/modeladmin/models.py17
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py
index b215e40af8..3c97931595 100644
--- a/tests/modeltests/model_formsets/models.py
+++ b/tests/modeltests/model_formsets/models.py
@@ -701,5 +701,4 @@ False
>>> formset.is_valid()
True
-
"""}
diff --git a/tests/regressiontests/modeladmin/models.py b/tests/regressiontests/modeladmin/models.py
index ca97a0cb51..f6fda40cf4 100644
--- a/tests/regressiontests/modeladmin/models.py
+++ b/tests/regressiontests/modeladmin/models.py
@@ -116,6 +116,23 @@ displayed because you forgot to add it to fields/fielsets
['name']
+# Using `exclude`.
+
+>>> class BandAdmin(ModelAdmin):
+... exclude = ['bio']
+>>> ma = BandAdmin(Band, site)
+>>> ma.get_form(request).base_fields.keys()
+['name', 'sign_date']
+
+# Using `fields` and `exclude`.
+
+>>> class BandAdmin(ModelAdmin):
+... fields = ['name', 'bio']
+... exclude = ['bio']
+>>> ma = BandAdmin(Band, site)
+>>> ma.get_form(request).base_fields.keys()
+['name']
+
If we specify a form, it should use it allowing custom validation to work
properly. This won't, however, break any of the admin widgets or media.