From 7c7455f9bc6d0441af687fbda1e6ff3aebc780dc Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Mon, 16 Jul 2018 20:20:21 +0200 Subject: [PATCH] get_object_or_404 au lieu de get_or_create dans le clean du rechargeForm. --- cotisations/forms.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cotisations/forms.py b/cotisations/forms.py index 19ab2fe7..4c4721a8 100644 --- a/cotisations/forms.py +++ b/cotisations/forms.py @@ -290,8 +290,7 @@ class RechargeForm(FormRevMixin, Form): the value is well inside the possible limits """ value = self.cleaned_data['value'] - balance_method, _created = balance.PaymentMethod\ - .objects.get_or_create() + balance_method, _created = get_object_or_404(balance.PaymentMethod) if balance_method.maximum_balance is not None and \ value + self.user.solde > balance_method.maximum_balance: raise forms.ValidationError(