Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
adress review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
monodo committed Sep 11, 2023
1 parent b782cc1 commit 16cab9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion geocity/apps/submissions/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BaseSubmissionFilterSet(django_filters.FilterSet):
forms__administrative_entities = django_filters.filters.ModelChoiceFilter(
queryset=_get_administrative_entities_queryset_for_current_user,
label=_("Entité administrative"),
widget=Select2Widget(attrs={"class": "form-select"}),
widget=Select2Widget(),
)
forms__category = django_filters.filters.ModelChoiceFilter(
queryset=_get_form_categories_queryset_for_current_user,
Expand Down
6 changes: 4 additions & 2 deletions geocity/apps/submissions/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,16 @@ def get_list_single_field_kwargs(self, field, default_kwargs):
return {
**default_kwargs,
"choices": choices,
"widget": Select2Widget(),
"widget": Select2Widget() if len(choices) > 5 else forms.Select(),
}

def get_list_multiple_field_kwargs(self, field, default_kwargs):
return {
**default_kwargs,
"choices": [(value, value) for value in field.choices.splitlines()],
"widget": Select2MultipleWidget(),
"widget": Select2MultipleWidget()
if len(field.choices) > 5
else forms.CheckboxSelectMultiple(),
}

def save(self):
Expand Down

0 comments on commit 16cab9c

Please sign in to comment.