Replies: 1 comment
-
Hi @Jfernal, Thank you for reaching out. Yes, what you are trying is possible but, since it varies from the default behavior, you will need to override the Best, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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'],
)
)
Beta Was this translation helpful? Give feedback.
All reactions