From 8fb8e14a30c3649c801d0742ec99555207317e37 Mon Sep 17 00:00:00 2001 From: Mael Kervella Date: Fri, 13 Apr 2018 11:40:02 +0000 Subject: [PATCH 1/2] Fix Use string and not variables in %-notation fornat --- cotisations/forms.py | 4 ++-- cotisations/payment.py | 2 +- cotisations/views.py | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cotisations/forms.py b/cotisations/forms.py index 524e878f..d0a891bd 100644 --- a/cotisations/forms.py +++ b/cotisations/forms.py @@ -355,7 +355,7 @@ class RechargeForm(FormRevMixin, Form): raise forms.ValidationError( _("Requested amount is too small. Minimum amount possible : \ %(min_online_amount)s €.") % { - min_online_amount: OptionalUser.get_cached_value( + 'min_online_amount': OptionalUser.get_cached_value( 'min_online_payment' ) } @@ -364,7 +364,7 @@ class RechargeForm(FormRevMixin, Form): raise forms.ValidationError( _("Requested amount is too high. Your balance can't exceed \ %(max_online_balance)s €.") % { - max_online_balance: OptionalUser.get_cached_value( + 'max_online_balance': OptionalUser.get_cached_value( 'max_solde' ) } diff --git a/cotisations/payment.py b/cotisations/payment.py index 0412ca94..652037fb 100644 --- a/cotisations/payment.py +++ b/cotisations/payment.py @@ -27,7 +27,7 @@ def accept_payment(request, factureid): messages.success( request, _("The payment of %(amount)s € has been accepted.") % { - amount: facture.prix() + 'amount': facture.prix() } ) return redirect(reverse('users:profil', kwargs={'userid':request.user.id})) diff --git a/cotisations/views.py b/cotisations/views.py index b946c3d6..d017a4a1 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -161,8 +161,8 @@ def new_facture(request, user, userid): request, _("The cotisation of %(member_name)s has been \ extended to %(end_date)s.") % { - member_name: user.pseudo, - end_date: user.end_adhesion() + 'member_name': user.pseudo, + 'end_date': user.end_adhesion() } ) # Else, only tell the invoice was created @@ -508,7 +508,7 @@ def del_paiement(request, instances): request, _("The payment method %(method_name)s has been \ successfully deleted.") % { - method_name: payment_del + 'method_name': payment_del } ) except ProtectedError: @@ -516,7 +516,7 @@ def del_paiement(request, instances): request, _("The payment method %(method_name)s can't be deleted \ because there are invoices using it.") % { - method_name: payment_del + 'method_name': payment_del } ) return redirect(reverse('cotisations:index-paiement')) @@ -586,7 +586,7 @@ def del_banque(request, instances): request, _("The bank %(bank_name)s has been successfully \ deleted.") % { - bank_name: bank_del + 'bank_name': bank_del } ) except ProtectedError: @@ -594,7 +594,7 @@ def del_banque(request, instances): request, _("The bank %(bank_name)s can't be deleted \ because there are invoices using it.") % { - bank_name: bank_del + 'bank_name': bank_del } ) return redirect(reverse('cotisations:index-banque')) @@ -779,8 +779,8 @@ def new_facture_solde(request, userid): request, _("The cotisation of %(member_name)s has been successfully \ extended to %(end_date)s.") % { - member_name: user.pseudo, - end_date: user.end_adhesion() + 'member_name': user.pseudo, + 'end_date': user.end_adhesion() } ) # Else, only tell the invoice was created From 34c5af62f44ddea88e8e8353c5e3eb6685f35cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Fri, 13 Apr 2018 12:32:39 +0000 Subject: [PATCH 2/2] Fix: Error rename --- cotisations/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cotisations/views.py b/cotisations/views.py index d017a4a1..bb2540ae 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -719,7 +719,7 @@ def new_facture_solde(request, userid): user = request.user invoice = Facture(user=user) payment, _created = Paiement.objects.get_or_create(moyen='Solde') - facture.paiement = payment + invoice.paiement = payment # The template needs the list of articles (for the JS part) article_list = Article.objects.filter( Q(type_user='All') | Q(type_user=request.user.class_name) @@ -827,9 +827,9 @@ def recharge(request): if refill_form.is_valid(): invoice = Facture(user=request.user) payment, _created = Paiement.objects.get_or_create(moyen='Rechargement en ligne') - facture.paiement = payment - facture.valid = False - facture.save() + invoice.paiement = payment + invoice.valid = False + invoice.save() purchase = Vente.objects.create( facture=invoice, name='solde',