Open
Description
Goal
How to pre populate multiple selected choices in HeavySelect2MultipleWidget and in ModelMultipleChoiceField
Problem
When form reloaded with validation error, all the pre selected choices will vanish for HeavySelect2MultipleWidget, ModelMultipleChoiceField
also not finding a way to pre populate the selected choices when you load update form...
Code Snippet
class RequestRegion(forms.Form):
region = forms.ModelMultipleChoiceField(queryset=Region.objects.all().order_by('region_id'),
widget=Select2MultipleWidget)
class CustReqForm(forms.Form):
#CustomerField(widget=CustomerHeavyWidget(data_view = 'customer_ajax', attrs={'data-minimum-input-length': 4, 'delay':200}))
distributor = forms.CharField(
widget=HeavySelect2MultipleWidget(data_view='customer_ajax',
attrs={'data-minimum-input-length': 4, 'delay':200},
), required=False #queryset=Customer.objects.none()
)