From a0352e2b7cca264bf3a74dee742866c2b8ea7e67 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Mon, 30 Dec 2024 22:51:47 +0100 Subject: [PATCH] Add sort order field to search form --- archivist/apps/sites/forms.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/archivist/apps/sites/forms.py b/archivist/apps/sites/forms.py index 919050c..5ee6ce2 100644 --- a/archivist/apps/sites/forms.py +++ b/archivist/apps/sites/forms.py @@ -27,7 +27,7 @@ class SearchForm(forms.Form): } ), ) - + sort = forms.ChoiceField( label="Sort by", choices=[('1', 'Date'), ('2', 'Views'), ('3', 'Likes'), ('4', 'Relevance')], @@ -39,7 +39,19 @@ class SearchForm(forms.Form): } ) ) - + + sort_order = forms.ChoiceField( + label="Sort order", + choices=[('1', 'Descending'), ('2', 'Ascending')], + initial='1', + required=False, + widget=forms.Select( + attrs={ + 'class': 'form-select', + } + ) + ) + mature = forms.ChoiceField( label="Filter by Mature", choices=[('1', 'All'),('2', 'General'), ('3', 'Mature/Adult')],