﻿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
31043	Form with ModelChoiceField and disabled failed when the initial is model instance.	Eran Keydar	nobody	"Got this issue in some more complex example, narrows down to this scenario:


{{{
class Form1(forms.Form):
    user = forms.ModelChoiceField(
        queryset=get_user_model().objects.all(),
        disabled=True,
        initial=get_user_model().objects.get(pk=1)
    )
    label = forms.CharField()
}}}

Then

{{{
In [12]: f = Form1(data={'label':'aaa'})                                        

In [13]: f.is_valid()                                                           
Out[13]: False

In [14]: f.errors                                                               
Out[14]: {'user': ['Select a valid choice. That choice is not one of the available choices.']}

}}}

If the initial changed to the pk itself, everything works fine




"	Bug	closed	Forms	3.0	Normal	duplicate			Unreviewed	0	0	0	0	0	0
