summaryrefslogtreecommitdiff
path: root/tests/regressiontests/modeladmin
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regressiontests/modeladmin')
-rw-r--r--tests/regressiontests/modeladmin/models.py17
1 files changed, 17 insertions, 0 deletions
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.