#23387: Error when saving inline formsets as new after a validation error.
-------------------------------------+-------------------------------------
Reporter: johnrtipton | Owner: tino
Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin formset | Triage Stage: Accepted
validation base10 |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by tino):
There is a problem with "Save as new" and validation errors in general.
When you click "Save as new" and a validation error is raised, the
`ModelAdmin.add_view` is returned, which does not include the "Save as
new" button, but the other save buttons. The url is still the change url
of the original object. This is confusing, as all the normal save buttons
work as "Save as new" buttons now.
I would suggest that in that case, we should only show the "Save as new"
button, and hide the others, as was proposed earlier in this patch.
If we would have to go in the direction to keep the other save buttons
(''and'' the "Save as new" button, all with correct functionality), the
fix for the underlying issue with the inline formsets is not easy. You
would have to validate both the object and it's inline instances
(https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1367),
and if either fails, reset the inline instances to instances where
`save_as_new` is False.
--
Ticket URL: <https://code.djangoproject.com/ticket/23387#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.c4a53e74c6efde3c02cab39b6ed11bbd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.