Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3270 closed defect (duplicate)

IntegrityError when using unique_together in model in admin interface

Reported by: anonymous Owned by: adrian
Component: contrib.admin Version: master
Severity: normal Keywords: IntegrityError
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I am using a model with unique_together. It looks similiar to this:

class Poll(models.Model):
  ...

class Vote(models.Model):
   vote = models.IntegerField("Vote", choices=Registration_Choice)
   poll = models.ForeignKey(Poll)
   user = models.ForeignKey(User)

   class Meta:
      unique_together = (('poll', 'user'),)

When I use the admin webinterface and create an Vote-Object with an not unique combination of poll and user, it will raise an unhandled IntegrityError.

Change History (3)

comment:1 Changed 9 years ago by ramiro <rm0 _at_ gmx.net>

To the person who filed this bug:

What database backend are you using?.

And just to confirm it: you are using the latest version of Django checked out from SVN, right?

comment:2 Changed 9 years ago by Gary Wilson <gary.wilson@…>

  • Resolution set to duplicate
  • Status changed from new to closed

This seems to be a duplicate of #1751.

comment:3 Changed 9 years ago by ramiro <rm0 _at_ gmx.net>

Gary,

I was waiting the answer from the poster of the ticket to be sure to mark it as a dupe of one of the existing reports. I wanted to know if she/he is using MySQL.

Anyways, it's good to see some activity here.

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