'Test support of show_hidden_initial by ModelMultipleChoiceField.'

def test_model_multiple_choice_show_hidden_initial(self):

    class PersonForm(forms.Form, ):
        persons = forms.ModelMultipleChoiceField(show_hidden_initial=True, queryset=Person.objects.all())
    person1 = Person.objects.create(name=u'Person    1')
    person2 = Person.objects.create(name=u'Person    2')
    form = PersonForm(initial={u'persons': [person1, person2]}, data={u'initial-persons': [str(person1.pk), str(person2.pk)], u'persons': [str(person1.pk), str(person2.pk)]})
    self.assertTrue(form.is_valid())
    self.assertFalse(form.has_changed())
    form = PersonForm(initial={u'persons': [person1, person2]}, data={u'initial-persons': [str(person1.pk), str(person2.pk)], u'persons': [str(person2.pk)]})
    self.assertTrue(form.is_valid())
    self.assertTrue(form.has_changed())
