mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change: display default package search parameter values in its form
The previous behavior was carried over from PHP. It has been requested that we use the true defaults when rendering the default form, making search a bit more sensible. Closes #269 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
0bfecb9844
commit
bfd592299c
3 changed files with 31 additions and 24 deletions
|
@ -40,7 +40,7 @@ async def packages_get(request: Request, context: Dict[str, Any],
|
|||
search_by = context["SeB"] = request.query_params.get("SeB", "nd")
|
||||
|
||||
# Query sort by.
|
||||
sort_by = context["SB"] = request.query_params.get("SB", "p")
|
||||
sort_by = request.query_params.get("SB", None)
|
||||
|
||||
# Query sort order.
|
||||
sort_order = request.query_params.get("SO", None)
|
||||
|
@ -93,13 +93,6 @@ async def packages_get(request: Request, context: Dict[str, Any],
|
|||
# Apply user-specified specified sort column and ordering.
|
||||
search.sort_by(sort_by, sort_order)
|
||||
|
||||
# If no SO was given, default the context SO to 'a' (Ascending).
|
||||
# By default, if no SO is given, the search should sort by 'd'
|
||||
# (Descending), but display "Ascending" for the Sort order select.
|
||||
if sort_order is None:
|
||||
sort_order = "a"
|
||||
context["SO"] = sort_order
|
||||
|
||||
# Insert search results into the context.
|
||||
results = search.results().with_entities(
|
||||
models.Package.ID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue