Add model to AddressForm example

model also seems to be required in widget as shown in test - https://github.com/applegrew/django-select2/blob/master/tests/testapp/forms.py
This commit is contained in:
Phoebe Bright 2017-08-23 22:07:32 +01:00 committed by Johannes Hoppe
parent 2000395c3b
commit c4b3fdfbef

View file

@ -37,6 +37,7 @@ Lets link two widgets via *dependent_fields*.
queryset=Country.objects.all(),
label=u"Country",
widget=ModelSelect2Widget(
model=Country,
search_fields=['name__icontains'],
)
)
@ -45,6 +46,7 @@ Lets link two widgets via *dependent_fields*.
queryset=City.objects.all(),
label=u"City",
widget=ModelSelect2Widget(
model=City,
search_fields=['name__icontains'],
dependent_fields={'country': 'country'},
max_results=500,