feat: improve transactions ordering

This commit is contained in:
Herculino Trotta
2024-11-10 20:45:05 -03:00
parent 05fc4bca7f
commit bc3c3360d0
3 changed files with 18 additions and 24 deletions

View File

@@ -78,16 +78,7 @@ def transactions_list(request, month: int, year: int):
)
)
if order == "default":
transactions_filtered = default_order(
transactions_filtered, extra_ordering=["date", "id"]
)
elif order == "newer":
transactions_filtered = transactions_filtered.order_by("-date", "id")
elif order == "older":
transactions_filtered = transactions_filtered.order_by("date", "id")
else:
transactions_filtered = transactions_filtered.order_by("date", "id")
transactions_filtered = default_order(transactions_filtered, order=order)
return render(
request,