diff options
| author | Tim Graham <timograham@gmail.com> | 2014-03-21 20:44:34 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-03-22 07:56:48 -0400 |
| commit | ee4edb1eda2ac8f09eb298929282b44776930c89 (patch) | |
| tree | 385d5f30d927069256aa57d0b44ac377ac06dfcc /docs | |
| parent | 1c8dbb0cc268c6a2edc8268776b440f64867e6fb (diff) | |
Made ModelForms raise ImproperlyConfigured if the list of fields is not specified.
Also applies to modelform(set)_factory and generic model views.
refs #19733.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/class-based-views/mixins-editing.txt | 11 | ||||
| -rw-r--r-- | docs/ref/forms/models.txt | 12 | ||||
| -rw-r--r-- | docs/topics/class-based-views/generic-editing.txt | 15 | ||||
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 10 |
4 files changed, 24 insertions, 24 deletions
diff --git a/docs/ref/class-based-views/mixins-editing.txt b/docs/ref/class-based-views/mixins-editing.txt index dbe1c91547..cfa343c937 100644 --- a/docs/ref/class-based-views/mixins-editing.txt +++ b/docs/ref/class-based-views/mixins-editing.txt @@ -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 diff --git a/docs/ref/forms/models.txt b/docs/ref/forms/models.txt index 1d2b468553..9700c1ed38 100644 --- a/docs/ref/forms/models.txt +++ b/docs/ref/forms/models.txt @@ -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. + + .. versionchanged:: 1.8 - The ``localized_fields``, ``labels``, ``help_texts``, and - ``error_messages`` parameters were added. + 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) diff --git a/docs/topics/class-based-views/generic-editing.txt b/docs/topics/class-based-views/generic-editing.txt index f12672df69..44680148ab 100644 --- a/docs/topics/class-based-views/generic-editing.txt +++ b/docs/topics/class-based-views/generic-editing.txt @@ -128,16 +128,15 @@ here; we don't have to write any logic ourselves:: We have to use :func:`~django.core.urlresolvers.reverse_lazy` here, not just ``reverse`` as the urls are not loaded when the file is imported. -.. versionchanged:: 1.6 +The ``fields`` attribute works the same way as the ``fields`` attribute on the +inner ``Meta`` class on :class:`~django.forms.ModelForm`. Unless you define the +form class in another way, the attribute is required and the view will raise +an :exc:`~django.core.exceptions.ImproperlyConfigured` exception if it's not. -In Django 1.6, the ``fields`` attribute was added, which works the same way as -the ``fields`` attribute on the inner ``Meta`` class on -:class:`~django.forms.ModelForm`. - -Omitting the fields attribute will work as previously, but is deprecated and -this attribute will be required from 1.8 (unless you define the form class in -another way). +.. versionchanged:: 1.8 + Omitting the ``fields`` attribute was previously allowed and resulted in a + form with all of the model's fields. Finally, we hook these new views into the URLconf:: diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index bd312562cb..a55e7a5ced 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -430,13 +430,11 @@ In addition, Django applies the following rule: if you set ``editable=False`` on the model field, *any* form created from the model via ``ModelForm`` will not include that field. -.. versionchanged:: 1.6 - - Before version 1.6, the ``'__all__'`` shortcut did not exist, but omitting - the ``fields`` attribute had the same effect. Omitting both ``fields`` and - ``exclude`` is now deprecated, but will continue to work as before until - version 1.8 +.. versionchanged:: 1.8 + In older versions, omitting both ``fields`` and ``exclude`` resulted in + a form with all the model's fields. Doing this now raises an + :exc:`~django.core.exceptions.ImproperlyConfigured` exception. .. note:: |
