From: Radek Czajka
Date: Thu, 1 Jun 2023 13:15:19 +0000 (+0200)
Subject: club fixes.
X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/e62a2d9038d696e88b58e624f87026af7073088e?ds=sidebyside;hp=0a7090f11131631647db366ff87976407e788412
club fixes.
---
diff --git a/src/club/forms.py b/src/club/forms.py
index 75213fc44..675c18dc5 100644
--- a/src/club/forms.py
+++ b/src/club/forms.py
@@ -135,7 +135,11 @@ class DonationStep1Form(forms.ModelForm):
'monthly'
]
-
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ club = models.Club.objects.first()
+ self.fields['custom_amount'].widget.attrs['min'] = club.min_amount
+
def clean(self):
state = {}
state['monthly'] = self.cleaned_data['switch'] == 'monthly'
diff --git a/src/club/payment_methods.py b/src/club/payment_methods.py
index 6bb6f8e67..8f5ff6bb8 100644
--- a/src/club/payment_methods.py
+++ b/src/club/payment_methods.py
@@ -32,12 +32,13 @@ class PayU(PaymentMethod):
def __init__(self, pos_id):
self.pos_id = pos_id
- def invite_widget(self, schedule):
+ def invite_widget(self, schedule, request):
return render_to_string(
'club/payment/payu_invite.html',
{
'schedule': schedule,
- }
+ },
+ request=request
)
def initiate(self, request, schedule):
@@ -66,7 +67,7 @@ class PayURe(PaymentMethod):
def initiate(self, request, schedule):
return reverse('club_payu_rec_payment', args=[schedule.key])
- def invite_widget(self, schedule):
+ def invite_widget(self, schedule, request):
from . import forms
pos = POSS[self.pos_id]
widget_args = {
@@ -93,9 +94,10 @@ class PayURe(PaymentMethod):
'pos': POSS[self.pos_id],
'widget_args': widget_args,
'widget_sig': widget_sig,
- }
+ },
+ request=request
)
-
+
def pay(self, request, schedule):
# Create order, put it and see what happens next.
from .models import PayUOrder
@@ -146,12 +148,13 @@ class PayPal(PaymentMethod):
is_recurring = True
is_onetime = False
- def invite_widget(self, schedule):
+ def invite_widget(self, schedule, request):
return render_to_string(
'club/payment/paypal_invite.html',
{
'schedule': schedule,
- }
+ },
+ request=request
)
def initiate(self, request, schedule):
diff --git a/src/club/templates/club/2022/donation_step4.html b/src/club/templates/club/2022/donation_step4.html
index f257111c1..fd14ca7ee 100644
--- a/src/club/templates/club/2022/donation_step4.html
+++ b/src/club/templates/club/2022/donation_step4.html
@@ -9,7 +9,7 @@
Zajrzyj teraz do e-maila. Tam znajdziesz link,
który powiÄ
że pÅatnoÅÄ z Twoim kontem użytkownika Wolnych Lektur.
- Wracam do lektur
+ Wracam do lektur
{% endblock %}
diff --git a/src/club/templates/club/2022/donation_step_base.html b/src/club/templates/club/2022/donation_step_base.html
index d4319ee2d..a87b6c374 100644
--- a/src/club/templates/club/2022/donation_step_base.html
+++ b/src/club/templates/club/2022/donation_step_base.html
@@ -20,7 +20,7 @@
diff --git a/src/club/templates/payu/rec_widget.html b/src/club/templates/payu/rec_widget.html
index 89b114b17..c02cc08f3 100644
--- a/src/club/templates/payu/rec_widget.html
+++ b/src/club/templates/payu/rec_widget.html
@@ -1,6 +1,6 @@
Podaj dane karty pÅatniczej
-
diff --git a/src/club/templatetags/club.py b/src/club/templatetags/club.py
index be7dda9f2..92fb5ca0b 100644
--- a/src/club/templatetags/club.py
+++ b/src/club/templatetags/club.py
@@ -80,6 +80,6 @@ def club_monthly_missing_since(start, target):
monthly=True, payed_at__gte=start).count()
-@register.simple_tag
-def invite_payment(payment_method, schedule):
- return payment_method.invite_widget(schedule)
+@register.simple_tag(takes_context=True)
+def invite_payment(context, payment_method, schedule):
+ return payment_method.invite_widget(schedule, context['request'])