forked from applegrew/django-select2
-
-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Goal
I want to use the chained select2 feature but it does not works fine.
Problem
Taking as example the below code snipped, the city field has to be populated according with country selection. However when country is null then the city is populated with data of all countries. Is it possible to make a child null when parent null?
Code Snippet
class AddressForm(forms.Form):
country = forms.ModelChoiceField(
queryset=Country.objects.all(),
label=u"Country",
widget=ModelSelect2Widget(
model=Country,
search_fields=['name__icontains'],
)
)
city = forms.ModelChoiceField(
queryset=City.objects.all(),
label=u"City",
widget=ModelSelect2Widget(
model=City,
search_fields=['name__icontains'],
dependent_fields={'country': 'country'},
max_results=500,
)
)
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested