id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 10769,"IntegrityError with generic relations, unique_together, and inline admin forms",rutt,nobody,"Using the models and admin below, create a new !GenericAttachment object using the inline form on the Parent change page. Then create another one with the same slug. The result is an IntegrityError where ""columns content_type_id, object_id, slug are not unique"". This works fine for Attachment objects. Models: {{{ class Parent(models.Model): name = models.CharField(max_length=200) class Attachment(models.Model): name = models.CharField(max_length=200) parent = models.ForeignKey(Parent) slug = models.SlugField() class Meta: unique_together = ['parent', 'slug'] class GenericAttachment(models.Model): name = models.CharField(max_length=200) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() parent = generic.GenericForeignKey() slug = models.SlugField() class Meta: unique_together = ['content_type', 'object_id', 'slug'] }}} Admin: {{{ class GenericAttachmentInline(generic.GenericTabularInline): model = GenericAttachment class ParentAdmin(admin.ModelAdmin): inlines = [AttachmentInline, GenericAttachmentInline] admin.site.register(Attachment, admin.ModelAdmin) admin.site.register(GenericAttachment, admin.ModelAdmin) admin.site.register(Parent, ParentAdmin) }}} ",,closed,contrib.admin,1.1-beta,,duplicate,,,Unreviewed,0,0,0,0,0,0