#20522: Admin formset validation cannot take submitted model instance into account when form not valid. -------------------------------+-------------------------------------- Reporter: meshy | Owner: nobody Type: Uncategorized | Status: new Component: Uncategorized | Version: 1.5 Severity: Normal | Keywords: admin formset validation Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------+-------------------------------------- In the admin, if the validation on an inline formset depends upon the data from the main form it cannot be correctly validated when the main form is not valid. This is because the instance from the incomplete form is not passed into the formset unless it is completely valid. Instead, on add (https://github.com/django/django/blob/1.5.1/django/contrib/admin/options.py#L988-L994), we get a completely blank new instance, or on change (https://github.com/django/django/blob/1.5.1/django/contrib/admin/options.py#L1085-L1091), we are passed the original instance.
I understand that the current way of doing things may stop invalid data being sent to the formsets but I believe, as this is the data that has been submitted, and the majority of it will likely be correct, that this would be better than the nothing we currently get. I propose that lines 994 and 1091 both change to `new_object = form.instance`. This would mean that in a fair number of cases the errors on the main form would not need to be fixed before the errors on the inline form become visible. I hope that my concerns/intention are clear, but if not, please ask and I will produce a working example and patch for examination. -- Ticket URL: <https://code.djangoproject.com/ticket/20522> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/048.9dc7a7d7dc8e70a5ea52f81d872c2f36%40djangoproject.com?hl=en. For more options, visit https://groups.google.com/groups/opt_out.