﻿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
10770	IntegrityError when creating multiple inline objects with ForeignKey and unique_together	rutt	nobody	"Using the models below, enter two Attachment objects with the same slug on the Parent change page, and then save.  The result is an IntegrityError where ""columns parent_id, slug are not unique"".  If the two Attachment objects are created and saved individually, the admin shows the expected form error: ""Attachment with this Parent and Slug already exists.""

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']
}}}

Admin:

{{{
class ParentAdmin(admin.ModelAdmin):
    inlines = [AttachmentInline]

admin.site.register(Attachment, admin.ModelAdmin)
admin.site.register(Parent, ParentAdmin)
}}}
"		closed	contrib.admin	1.1-beta		duplicate			Unreviewed	0	0	0	0	0	0
