Made ModelForms raise ImproperlyConfigured if the list of fields is not specified.

Also applies to modelform(set)_factory and generic model views.

refs #19733.
This commit is contained in:
Tim Graham 2014-03-21 20:44:34 -04:00
parent 1c8dbb0cc2
commit ee4edb1eda
9 changed files with 77 additions and 100 deletions

View file

@ -129,15 +129,18 @@ ModelFormMixin
.. attribute:: fields
.. versionadded:: 1.6
A list of names of fields. This is interpreted the same way as the
``Meta.fields`` attribute of :class:`~django.forms.ModelForm`.
This is a required attribute if you are generating the form class
automatically (e.g. using ``model``). Omitting this attribute will
result in all fields being used, but this behavior is deprecated
and will be removed in Django 1.8.
result in an :exc:`~django.core.exceptions.ImproperlyConfigured`
exception.
.. versionchanged:: 1.8
Previously, omitting this attribute was allowed and resulted in
a form with all fields of the model.
.. attribute:: success_url