From c74504c2dd21974571ab72805fbfc8d4d76ce151 Mon Sep 17 00:00:00 2001 From: Jay Leadbetter Date: Thu, 14 Nov 2013 19:26:19 -0700 Subject: 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. --- docs/ref/contrib/admin/index.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 3313f99250..efd72f58db 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -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 -- cgit v1.3