diff --git a/CHANGELOG.md b/CHANGELOG.md index 43b2d22..c98d5ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Improved * game overview: improve how editions and purchases are displayed +* add purchase: only allow choosing purchases of selected edition ## 1.5.1 / 2023-11-14 21:10+01:00 diff --git a/games/forms.py b/games/forms.py index 19af792..a5e4384 100644 --- a/games/forms.py +++ b/games/forms.py @@ -1,5 +1,5 @@ from django import forms - +from django.urls import reverse from games.models import Game, Platform, Purchase, Session, Edition, Device custom_date_widget = forms.DateInput(attrs={"type": "date"}) @@ -50,6 +50,20 @@ class IncludePlatformSelect(forms.Select): class PurchaseForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # Automatically update related_purchase