﻿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
19467	Admin inlines doesn't properly call model.clean()	Marc Aymerich	nobody	"Seems that model forms or admin dones't clean correctly inline forms. 
{{{
#!python
class Child(models.Model):
   parent = models.ForeignKey(Parent)
   something = models.CharField(blank=True, null=True, unique=True)

   def clean(self):
       if self.something == '':
           self.something = None
       super(Child, self).clean()
}}}

Postgres raises a: duplicate key value violates unique constraint ""child_something_key""

I've made a little hack on django's code and call child.clean() just before child.save(), and then it works. Also I've tried a similar scenario with an admin.ModelAdmin instead of admin.TabularInline and it works to. So it must be a bug somewhere on the inlines. 


Node: I'm using master, not tested with 1.4

thanks."	Bug	closed	Uncategorized	dev	Normal	needsinfo	admin inline clean		Unreviewed	0	0	0	0	0	0
