also sort purchases by created_at
This commit is contained in:
parent
f8d621e710
commit
d9290373b0
|
@ -26,7 +26,7 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
||||||
context: dict[Any, Any] = {}
|
context: dict[Any, Any] = {}
|
||||||
page_number = request.GET.get("page", 1)
|
page_number = request.GET.get("page", 1)
|
||||||
limit = request.GET.get("limit", 10)
|
limit = request.GET.get("limit", 10)
|
||||||
purchases = Purchase.objects.order_by("-date_purchased")
|
purchases = Purchase.objects.order_by("-date_purchased", "-created_at")
|
||||||
page_obj = None
|
page_obj = None
|
||||||
if int(limit) != 0:
|
if int(limit) != 0:
|
||||||
paginator = Paginator(purchases, limit)
|
paginator = Paginator(purchases, limit)
|
||||||
|
|
Loading…
Reference in New Issue