#19467: Admin inlines doesn't properly call model.clean() -------------------------------+-------------------------------- Reporter: glic3rinu | Owner: nobody Type: Bug | Status: new Component: Uncategorized | Version: master Severity: Normal | Keywords: admin inline clean Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------------------- Seems that model forms or admin dones't clean correctly inline forms.
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. -- Ticket URL: <https://code.djangoproject.com/ticket/19467> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.