The Great Magnet. What a fool I was to defy him.

Duplicate Key IntegrityError Django

May 13, 2008 · Leave a Comment

If you are wondering what part of your Django model is wrong because it is spitting out a nameless IntegrityError, it might be this:

I had a model with Unique=True & Blank=True that caused description-less IntegrityErrors because with two objects that have a field ” (blank), or Null, it was no longer unique.

I wanted the field to be Unique, IF and only if it was not blank or null.

I’ll just use Blank=True, null=True and let it be not unique if it ever does.

Categories: Django
Tagged: ,

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment