﻿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
12304	modelForm/unique_together error 'Foo bar with this None and None already exists.'	johnsmith	Ramiro Morales	"""Foo bar with this None and None already exists."" 

Try to save a combination of foo and bar that already exists using the form below and the
error message says ""this None and None"", comment out the field
overrides and there's no problem. 
Not sure whether the problem is with unique_together or ModelForm.


Models
{{{
class Foo(models.Model):
    f = models.IntegerField(unique=True)
    def __unicode__(self):
        return 'Foo with f = %d' % self.f

class Bar(models.Model):
    b = models.IntegerField(unique=True)
    def __unicode__(self):
        return 'Bar with b = %d' % self.b

class FooBar(models.Model):
   foo = models.ForeignKey('Foo')
   bar = models.ForeignKey('Bar')

   class Meta:
       unique_together = (('foo','bar'),)
}}}


Form
{{{
class FooBarForm(forms.ModelForm):
    foo = forms.ModelChoiceField(Foo.objects.all()) # comment this line out an the error message is correct
    bar = forms.ModelChoiceField(Bar.objects.all()) # comment this line out an the error message is correct

    class Meta:
        model = FooBar
}}}
"		closed	Forms	1.1		fixed	ModelForm unique_together unique wwith this None already exists		Ready for checkin	1	0	0	0	0	0
