mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user