Order purchases by date on game view

This commit is contained in:
Lukáš Kucharczyk 2023-11-14 19:30:19 +01:00
parent 7ba212e718
commit c4fdefadb0
2 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,9 @@
* Season Pass * Season Pass
* Battle Pass * Battle Pass
## Fixed
* Order purchases by date on game view
## 1.4.0 / 2023-11-09 21:01+01:00 ## 1.4.0 / 2023-11-09 21:01+01:00
### New ### New

View File

@ -141,8 +141,10 @@ def view_game(request, game_id=None):
context["title"] = "View Game" context["title"] = "View Game"
context["game"] = game context["game"] = game
context["editions"] = Edition.objects.filter(game_id=game_id) context["editions"] = Edition.objects.filter(game_id=game_id)
game_purchases = Purchase.objects.filter(edition__game_id=game_id).filter( game_purchases = (
type=Purchase.GAME Purchase.objects.filter(edition__game_id=game_id)
.filter(type=Purchase.GAME)
.order_by("date_purchased")
) )
for purchase in game_purchases: for purchase in game_purchases:
purchase.related_purchases = Purchase.objects.exclude( purchase.related_purchases = Purchase.objects.exclude(