1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Removed versionadded/changed notes for 1.7.

This commit is contained in:
Tim Graham
2015-01-26 15:39:52 -05:00
parent 0e60912492
commit c79faae761
64 changed files with 100 additions and 864 deletions

View File

@@ -343,8 +343,6 @@ excessive.
``validate_min``
~~~~~~~~~~~~~~~~
.. versionadded:: 1.7
If ``validate_min=True`` is passed to
:func:`~django.forms.formsets.formset_factory`, validation will also check
that the number of forms in the data set, minus those marked for
@@ -371,11 +369,6 @@ deletion, is greater than or equal to ``min_num``.
>>> formset.non_form_errors()
['Please submit 3 or more forms.']
.. versionchanged:: 1.7
The ``min_num`` and ``validate_min`` parameters were added to
:func:`~django.forms.formsets.formset_factory`.
Dealing with ordering and deletion of forms
-------------------------------------------
@@ -502,29 +495,15 @@ If you are using a :class:`ModelFormSet<django.forms.models.BaseModelFormSet>`,
model instances for deleted forms will be deleted when you call
``formset.save()``.
.. versionchanged:: 1.7
If you call ``formset.save(commit=False)``, objects will not be deleted
automatically. You'll need to call ``delete()`` on each of the
:attr:`formset.deleted_objects
<django.forms.models.BaseModelFormSet.deleted_objects>` to actually delete
them::
If you call ``formset.save(commit=False)``, objects will not be deleted
automatically. You'll need to call ``delete()`` on each of the
:attr:`formset.deleted_objects
<django.forms.models.BaseModelFormSet.deleted_objects>` to actually delete
them::
>>> instances = formset.save(commit=False)
>>> for obj in formset.deleted_objects:
... obj.delete()
If you want to maintain backwards compatibility with Django 1.6 and earlier,
you can do something like this::
>>> try:
>>> # For Django 1.7+
>>> for obj in formset.deleted_objects:
>>> obj.delete()
>>> except AssertionError:
>>> # Django 1.6 and earlier already deletes the objects, trying to
>>> # delete them a second time raises an AssertionError.
>>> pass
>>> instances = formset.save(commit=False)
>>> for obj in formset.deleted_objects:
... obj.delete()
On the other hand, if you are using a plain ``FormSet``, it's up to you to
handle ``formset.deleted_forms``, perhaps in your formset's ``save()`` method,

View File

@@ -275,8 +275,6 @@ Error messages defined on :attr:`model fields
<validating-objects>` step and no corresponding error messages are defined at
the form level.
.. versionadded:: 1.7
You can override the error messages from ``NON_FIELD_ERRORS`` raised by model
validation by adding the :data:`~django.core.exceptions.NON_FIELD_ERRORS` key
to the ``error_messages`` dictionary of the ``ModelForm``s inner ``Meta`` class::
@@ -656,15 +654,11 @@ There are a couple of things to note, however.
used. This means the child's ``Meta``, if it exists, otherwise the
``Meta`` of the first parent, etc.
.. versionchanged:: 1.7
* It's possible to inherit from both ``Form`` and ``ModelForm`` simultaneously,
however, you must ensure that ``ModelForm`` appears first in the MRO. This is
because these classes rely on different metaclasses and a class can only have
one metaclass.
.. versionadded:: 1.7
* It's possible to declaratively remove a ``Field`` inherited from a parent class by
setting the name to be ``None`` on the subclass.