#9231: get_or_create creates even if the object is already there
------------------------------------------+---------------------------------
Reporter: canburak | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 0.96
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
my model is
{{{
class InvitationStatistic(models.Model):
email_address = models.EmailField(max_length=125,
db_index=True,
unique=True)
number_of_retries = models.IntegerField(default=0)
}}}
the code triggered the error is?
{{{
obj, created =
InvitationStatistic.objects.get_or_create(email_address=self.invitee)
}}}
error is:
{{{
2008-09-28 08:17:56 EEST ERROR: duplicate key value violates unique
constraint "user_invitationstatistic_email_address_key"
2008-09-28 08:17:56 EEST STATEMENT: INSERT INTO
"user_invitationstatistic" ("email_address", "number_of_retries") VALUES
(E'[EMAIL PROTECTED]', 0)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/9231>
Django <http://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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---