﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34774	ModelAdmin form validation that cross-validates main form and inline formsets	ldeluigi	nobody	"I'd like to validate the admin change form submission for my entity together with its inline formsets.
In particular, I need to compute and validate a field based on the model relationships, that is its inlines that were submitted.
I can't use any of the forms `clean()`  method because they can't access other forms of the same submission, unless I'm parsing the request manually (duplicating the code from the inline formset arguments parser).

Proposal:
instead of calling the `all_valid()` method directly from `_changeform_view()` in the ModelAdmin implementation, you could first call an instance method like for example `self.validate_formsets(form, formsets)` which returns True if all the forms are valid.

The default implementation in ModelAdmin would be:

{{{
def validate_formsets(self, form, formsets):
    form_validated = form.is_valid()
    return all_valid(formsets) and form_validated
}}}


then users can override it to customize the behavior, including cross-validating forms cleaned data.

"	New feature	closed	contrib.admin	4.2	Normal	duplicate	formsets crossvalidation inlines form admin modeladmin		Unreviewed	0	0	0	0	1	0
