From c4fdefadb0cdd4237848643e87a9fb43b21985f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Tue, 14 Nov 2023 19:30:19 +0100 Subject: [PATCH] Order purchases by date on game view --- CHANGELOG.md | 3 +++ games/views.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1335ef..760e1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * Season Pass * Battle Pass +## Fixed +* Order purchases by date on game view + ## 1.4.0 / 2023-11-09 21:01+01:00 ### New diff --git a/games/views.py b/games/views.py index b2bab74..c859d5f 100644 --- a/games/views.py +++ b/games/views.py @@ -141,8 +141,10 @@ def view_game(request, game_id=None): context["title"] = "View Game" context["game"] = game context["editions"] = Edition.objects.filter(game_id=game_id) - game_purchases = Purchase.objects.filter(edition__game_id=game_id).filter( - type=Purchase.GAME + game_purchases = ( + Purchase.objects.filter(edition__game_id=game_id) + .filter(type=Purchase.GAME) + .order_by("date_purchased") ) for purchase in game_purchases: purchase.related_purchases = Purchase.objects.exclude(