I am new to this field. I am working on Dependent Dropdowns for which i took reference from here. On replicating the same with the following code:
Forms.py
class AddressForm(forms.ModelForm):
class Meta:
model=City
country = forms.ModelChoiceField(
queryset=Country.objects.all(),
label=u"Country",
widget= ModelSelect2Widget(
search_fields=['name__icontains'],
dependent_fields={'city': 'cities'},
)
)
city = forms.ModelChoiceField(
queryset=City.objects.all(),
label=u"City",
widget=ModelSelect2Widget(
search_fields=['name__icontains'],
dependent_fields={'country': 'country'},
max_results=500,
)
)
Getting error
Undefined variable: 'ModelSelect2Widget'
I also installed:
INSTALLED_APPS=[
'django_select2',
'django_q',
]