mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -34,16 +34,16 @@ Model Form Functions
|
||||
|
||||
See :ref:`modelforms-factory` for example usage.
|
||||
|
||||
.. versionchanged:: 1.6
|
||||
|
||||
You must provide the list of fields explicitly, either via keyword arguments
|
||||
``fields`` or ``exclude``, or the corresponding attributes on the form's
|
||||
inner ``Meta`` class. See :ref:`modelforms-selecting-fields` for more
|
||||
information. Omitting any definition of the fields to use will result in all
|
||||
fields being used, but this behavior is deprecated.
|
||||
information. Omitting any definition of the fields to use will result in
|
||||
an :exc:`~django.core.exceptions.ImproperlyConfigured` exception.
|
||||
|
||||
The ``localized_fields``, ``labels``, ``help_texts``, and
|
||||
``error_messages`` parameters were added.
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
Previously, omitting the list of fields was allowed and resulted in
|
||||
a form with all fields of the model.
|
||||
|
||||
.. function:: modelformset_factory(model, form=ModelForm, formfield_callback=None, formset=BaseModelFormSet, extra=1, can_delete=False, can_order=False, max_num=None, fields=None, exclude=None, widgets=None, validate_max=False, localized_fields=None, labels=None, help_texts=None, error_messages=None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user