diff options
| author | Jay Leadbetter <jay.leadbetter@gmail.com> | 2013-11-14 19:26:19 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-11-25 20:01:16 -0500 |
| commit | c74504c2dd21974571ab72805fbfc8d4d76ce151 (patch) | |
| tree | df8996aa78b584d2d467f06849d71a5b0205c685 /django | |
| parent | 1c7a83ee8e3da431d9d21dae42da8f1f89973f7c (diff) | |
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.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/options.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index e67f081557..2f39c6a896 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1261,7 +1261,7 @@ class ModelAdmin(BaseModelAdmin): form_validated = True else: form_validated = False - new_object = self.model() + new_object = form.instance formsets, inline_instances = self._create_formsets(request, new_object) if all_valid(formsets) and form_validated: self.save_model(request, new_object, form, False) @@ -1342,7 +1342,7 @@ class ModelAdmin(BaseModelAdmin): new_object = self.save_form(request, form, change=True) else: form_validated = False - new_object = obj + new_object = form.instance formsets, inline_instances = self._create_formsets(request, new_object) if all_valid(formsets) and form_validated: self.save_model(request, new_object, form, True) |
