Is it posible to set selected value for ModelChoiceField when form is unbound?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
class LicenseTypeForm(forms.ModelForm):
product = forms.ModelChoiceField(label=_('Product:'),
queryset=Product.objects.none())
license_type_name = forms.CharField(label=_('License type name'),
widget=forms.TextInput(attrs={'class': 'text'}))
class Meta:
model = LicenseType
def __init__(self, user, *args, **kwargs):
super(LicenseTypeForm, self).__init__(*args, **kwargs)
self.fields['product'].queryset = Product.objects.for_user(user)