﻿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
7353	Add manipulator fails when unique together fields added	m.gajda@…	nobody	"Hi, everyone!

Below some code, to ilustrate an issue I found:


{{{
class A( models.Model ):
  foo = models.CharField()

class B( models.Model ):
  x = models.ForeignKey( A )
  y = models.ForeignKey( B )

  class Meta:
    unique_together = ( ( x , y ) , )
}}}

For this piece of code, after adding some objects for ""A"" model using admin there is no possibility to add something to model ""B' (using this same admin). In this case database backed (PostgreSQL in my case) returns error message worrying about wrong comparison operator used to looking for already added object pair.

It raises this error because it tries to compares ""y"" field using proper ""__pk"" lookup, but for ""x"" field it invokes ""__iexact"" lookup method. The second one fails, because it should be used only for strings.

After some code investigation I found some weird pair of assigments in file ""django/db/models/manipulators.py"", which I changed according to attached patch. Now everything seems to work correctly."		closed	contrib.admin	newforms-admin		invalid	admin maniuplator add iexact fail nfa-blocker	m.gajda@… cmawebsite@…	Accepted	1	0	0	1	0	0
