Opened 12 years ago

Last modified 12 years ago

#19467 closed Bug

Admin inlines doesn't properly call model.clean() — at Initial Version

Reported by: Marc Aymerich Owned by: nobody
Component: Uncategorized Version: dev
Severity: Normal Keywords: admin inline clean
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top