﻿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
13100	Model docs imply that ModelForm will call Model.full_clean(), but it won't.	Oroku Saki	jkocherhans	"I created a documentation ticket for this thinking the model validation docs weren't clear enough, but then on further investigation, here's what I found ('''A pretty important bug for those using the new model validation'''):

{{{BaseForm.is_valid()}}} calls {{{BaseForm._get_errors()}}} calls {{{BaseForm.full_clean()}}} calls {{{BaseForm._post_clean()}}} which calls the following 3 methods:

{{{
Model.clean_fields()
Model.clean()
BaseForm.validate_unique() which calls Model.validate_unique()
}}}

{{{Model.full_clean()}}} as defined on line 808 of {{{django.db.models.base.py}}} is never called anywhere in Django, period. This means that the docs are incorrect because ModelForms do not include a call to {{{Model.full_clean()}}}. This means that you cannot use transactions in Model methods (except maybe with hacking) because a full validation from one method isn't included. I'm trying to do this:

{{{
    @transaction.commit_on_success
    def full_clean(exclude=None):
        super(MyModel, self).full_clean(exclude)
    
    def clean(self):
        # Creating necessary related instance to attach to self.some_foreign_key (expecting this to be undone buy transaction mentioned above if self.save() never completes)
}}}

But this is not possible because my {{{full_clean()}}} method is never called unless I create a view for this and manually run {{{my_new_instance.full_clean()}}}, but then it defeats the purpose of doing it, which is to protect my model's integrity at the model level so that I can use the Admin, a custom view, or a JSON API using Piston."		closed	Documentation	1.2-beta		fixed			Ready for checkin	1	0	0	0	0	0
