Export to GitHub

django-tagging - issue #276

1062 integrity error when saving a model


Posted on Jun 5, 2012 by Grumpy Horse

I'm getting this error (snippet: http://dpaste.org/JfeWw/ ) per debugging, on line 7 both force_insert and force_update == False but as you can see on line 19, the tag is becoming force_insert=True, which ends up running this command: INSERT INTO tagging_taggeditem (tag_id, content_type_id, object_id) VALUES (13, 16, 511)

but those values already exist (because I'm just updating the object)

Comment #1

Posted on Jun 5, 2012 by Grumpy Horse

well after a little more debugging I found out that's probably not the cause the tags for this article are "brasil,Brasil,", which translate to the same tag when doing the query, so it actually tries to add "brasil" twice

any ideas for the best solution to ignore duplicate tags?

Status: New