﻿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
16168	Form validation is bypassed on Admin Inline ModelForms that define extra fields	izzaddin.ruhulessin@…	nobody	"When defining extra/overridden fields on modelforms, validation is bypassed. This can lead to errors under some circumstances. 

For example, you have a model 'Book' that defines a ForeignKey to 'Author' named 'author'. On your ModelForm you replace this field by a CharField (or some other type) for whatever reason.

On submitting an invalid form, a ValueError will be raised complaining that the datatype is incorrect.

My proposed solution is overriding ModelForm._post_clean():

{{{
#!div style=""font-size: 80%""
  {{{#!python
class ModelForm(BaseModelForm):

    def _post_clean(self):
        if len(self._errors) == 0:
            super(ModelForm, self)._post_clean()
        
  }}}
}}}

"	Cleanup/optimization	closed	Documentation	dev	Normal	fixed	validation, modelforms		Accepted	1	0	0	0	1	0
