fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add forms export to zip.
[wolnelektury.git]
/
src
/
club
/
forms.py
diff --git
a/src/club/forms.py
b/src/club/forms.py
index
8df7783
..
ed18e22
100644
(file)
--- a/
src/club/forms.py
+++ b/
src/club/forms.py
@@
-3,11
+3,13
@@
#
from decimal import Decimal
from django import forms
#
from decimal import Decimal
from django import forms
+from django.utils.translation import ugettext as _
+from newsletter.forms import NewsletterForm
from . import models
from .payu.forms import CardTokenForm
from . import models
from .payu.forms import CardTokenForm
-class ScheduleForm(forms.ModelForm):
+class ScheduleForm(forms.ModelForm
, NewsletterForm
):
class Meta:
model = models.Schedule
fields = ['monthly', 'amount', 'email']
class Meta:
model = models.Schedule
fields = ['monthly', 'amount', 'email']
@@
-20,9
+22,17
@@
class ScheduleForm(forms.ModelForm):
value = self.cleaned_data['amount']
club = models.Club.objects.first()
if club and value < club.min_amount:
value = self.cleaned_data['amount']
club = models.Club.objects.first()
if club and value < club.min_amount:
- raise forms.ValidationError('Minimalna kwota to %d zł.' % club.min_amount)
+ raise forms.ValidationError(
+ _('Minimal amount is %(amount)d PLN.') % {
+ 'amount': club.min_amount
+ }
+ )
return value
return value
+ def save(self, *args, **kwargs):
+ NewsletterForm.save(self, *args, **kwargs)
+ return super().save(*args, **kwargs)
+
class PayUCardTokenForm(CardTokenForm):
def get_queryset(self, view):
class PayUCardTokenForm(CardTokenForm):
def get_queryset(self, view):