Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions django_select2/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ def get_queryset(self):
"""
if self.queryset is not None:
queryset = self.queryset
elif hasattr(self.choices, 'queryset'):
queryset = self.choices.queryset
elif self.model is not None:
queryset = self.model._default_manager.all()
else:
Expand Down
2 changes: 0 additions & 2 deletions tests/testapp/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ class AddressChainedSelect2WidgetForm(forms.Form):
queryset=Country.objects.all(),
label='Country',
widget=ModelSelect2Widget(
model=Country,
search_fields=['name__icontains'],
max_results=500,
dependent_fields={'city': 'cities'},
Expand All @@ -198,7 +197,6 @@ class AddressChainedSelect2WidgetForm(forms.Form):
queryset=City.objects.all(),
label='City',
widget=ModelSelect2Widget(
model=City,
search_fields=['name__icontains'],
dependent_fields={'country': 'country'},
max_results=500,
Expand Down