How do I render a form with several items in the ModelMultipleChoiceField selected? So the rendered html page looks like the below:
willing_to_judge = forms.ModelMultipleChoiceField(
queryset = WillingToJudge.objects.all(),
widget = forms.SelectMultiple,
required = False,
label = 'Willing to Judge:',
help_text = 'Hold down “Control”, or “Command” on a Mac, to select more than one.',
)
I tried adding initial
willing_to_judge = forms.ModelMultipleChoiceField(
queryset = WillingToJudge.objects.all(),
widget = forms.SelectMultiple,
initial = [WillingToJudge.MCMProblemSet.NONE],
required = False,
label = 'Willing to Judge:',
help_text = 'Hold down “Control”, or “Command” on a Mac, to select more than one.',
)
Changing things in __init__
self.fields['willing_to_judge'].initial = [WillingToJudge.MCMProblemSet.NONE]
Populating the form field is /not/ the problem. Select items in the form field is the problem. Any help would be appreciated.
Thank you.