From ca86db3caae37c334640b602cf91e612e471811f Mon Sep 17 00:00:00 2001 From: actlikewill Date: Mon, 29 Jul 2024 14:54:09 +0300 Subject: [PATCH] fixes alphabet filtering --- peachjam/forms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/peachjam/forms.py b/peachjam/forms.py index a25eb8933..9195320ed 100644 --- a/peachjam/forms.py +++ b/peachjam/forms.py @@ -108,7 +108,7 @@ class BaseDocumentFilterForm(forms.Form): """ years = PermissiveTypedListField(coerce=int, required=False) - alphabet = PermissiveTypedListField(required=False) + alphabet = forms.CharField(required=False) authors = PermissiveTypedListField(coerce=remove_nulls, required=False) doc_type = PermissiveTypedListField(coerce=remove_nulls, required=False) judges = PermissiveTypedListField(coerce=remove_nulls, required=False) @@ -140,7 +140,7 @@ def __init__(self, defaults, data, *args, **kwargs): def filter_queryset(self, queryset, exclude=None, filter_q=False): years = self.cleaned_data.get("years", []) - alphabet = self.cleaned_data.get("alphabet", []) + alphabet = self.cleaned_data.get("alphabet") authors = self.cleaned_data.get("authors", []) courts = self.cleaned_data.get("courts", []) doc_type = self.cleaned_data.get("doc_type", []) @@ -159,7 +159,7 @@ def filter_queryset(self, queryset, exclude=None, filter_q=False): queryset = queryset.filter(date__year__in=years) if alphabet and exclude != "alphabet": - queryset = queryset.filter(title__istartswith=alphabet[0]) + queryset = queryset.filter(title__istartswith=alphabet) if authors and exclude != "authors": queryset = queryset.filter(authors__name__in=authors)