﻿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
13091	admin list_editable with unique_together raises Integrity Error	Sławek Ehlert	nobody	"I'm getting an Integrity Error when trying to edit (on changelist) a model that has some unique_together fields and is
registered with list_editable containing some of that fields (not all of them).

Example

{{{
#models.py
class Test(models.Model):
    t1 = models.CharField(max_length=255, blank=True, null=True)
    t2 = models.CharField(max_length=255, blank=True, null=True)
    t3 = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        unique_together = ['t1','t2','t3']

#admin.py
class TestAdmin(admin.ModelAdmin):
    list_display = ['t3', 't1', 't2']
    list_editable = ['t1', 't2',]

admin.site.register(Test, TestAdmin)
}}}

the changelist form (?) doesn't check the uniqueness of an edited record. 

Integrity Error is raised when for example having two rows - 

first: t1 = 'a', t2 = 'b', t3 = 'z' 

and second: t1 = 'a', t2 = 'a', t3 = 'z' 

and trying to change the t2 in first row to 'a'.

In case when all fields from unique_together are in list_editable, the error message does show. However it isn't very informative (only ""Please correct the errors below."" but nothing below is indicated). 

Done this on sqlite3 and PostgreSQL."	Bug	new	Forms	dev	Normal		list_editable unique_together IntegrityError	Oroku Saki Sebastian Goll carsten.fuchs@… someuniquename@… Rafael Ferreira Carlton Gibson Carlos Palol Ryan Jarvis Dan Madere Gabriel Rojas	Accepted	0	0	0	0	0	0
