mirror of
https://github.com/django/django.git
synced 2025-08-01 17:42:56 +00:00
ModelAdmin.fields wasn't able to refer to fields only on a custom form
Regressed in r11737 which used get_field instead of opts.get_field and ignoring fields not found. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12279 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dbad025637
commit
4d81874f9d
2 changed files with 20 additions and 1 deletions
|
@ -215,4 +215,18 @@ ImproperlyConfigured: 'FieldsetBookAdmin.fieldsets[1][1]['fields']' can't includ
|
|||
# the validation will fail.
|
||||
>>> validate(BookAdmin, Book)
|
||||
|
||||
# Regression for ensuring ModelAdmin.fields can contain non-model fields
|
||||
# that broke with r11737
|
||||
|
||||
>>> class SongForm(forms.ModelForm):
|
||||
... extra_data = forms.CharField()
|
||||
... class Meta:
|
||||
... model = Song
|
||||
|
||||
>>> class FieldsOnFormOnlyAdmin(admin.ModelAdmin):
|
||||
... form = SongForm
|
||||
... fields = ['title', 'extra_data']
|
||||
|
||||
>>> validate(FieldsOnFormOnlyAdmin, Song)
|
||||
|
||||
"""}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue