1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #20522 - Allowed use of partially validated object in ModelAdmin.add_view formset validation.

Updated ModelAdmin to use form.instance when passing parent model to
child inlines for add_view. There is effectively no change in the
change_view since the previously passed 'obj' is the same as form.instance.

Thanks to meshy for report, and EvilDMP and timo for review.
This commit is contained in:
Jay Leadbetter
2013-11-14 19:26:19 -07:00
committed by Tim Graham
parent 1c7a83ee8e
commit c74504c2dd
5 changed files with 115 additions and 5 deletions

View File

@@ -1870,6 +1870,12 @@ The ``InlineModelAdmin`` class adds:
through to :func:`~django.forms.models.inlineformset_factory` when
creating the formset for this inline.
.. warning::
When writing custom validation for ``InlineModelAdmin`` forms, be cautious
of writing validation that relies on features of the parent model. If the
parent model fails to validate, it may be left in an inconsistent state as
described in the warning in :ref:`validation-on-modelform`.
.. attribute:: InlineModelAdmin.extra
This controls the number of extra forms the formset will display in