fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add banner style.
[wolnelektury.git]
/
src
/
club
/
forms.py
diff --git
a/src/club/forms.py
b/src/club/forms.py
index
f6b3bf9
..
22b0554
100644
(file)
--- a/
src/club/forms.py
+++ b/
src/club/forms.py
@@
-1,5
+1,5
@@
-# This file is part of Wolne
l
ektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja
Nowoczesna Polska
. See NOTICE for more information.
+# This file is part of Wolne
L
ektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja
Wolne Lektury
. See NOTICE for more information.
#
from decimal import Decimal
from django import forms
#
from decimal import Decimal
from django import forms
@@
-31,7
+31,8
@@
class DonationStep1Form(forms.ModelForm):
'monthly'
]
'monthly'
]
- def __init__(self, *args, **kwargs):
+ def __init__(self, *args, referer=None, **kwargs):
+ self.referer = referer
super().__init__(*args, **kwargs)
club = models.Club.objects.first()
if club is not None:
super().__init__(*args, **kwargs)
club = models.Club.objects.first()
if club is not None:
@@
-48,6
+49,9
@@
class DonationStep1Form(forms.ModelForm):
return state
return state
+ def save(self, *args, **kwargs):
+ self.instance.source = self.referer
+ return super().save(*args, **kwargs)
class DonationStep2Form(forms.ModelForm, NewsletterForm):
class DonationStep2Form(forms.ModelForm, NewsletterForm):
@@
-64,8
+68,7
@@
class DonationStep2Form(forms.ModelForm, NewsletterForm):
'monthly': forms.HiddenInput,
}
'monthly': forms.HiddenInput,
}
- def __init__(self, referer=None, **kwargs):
- self.referer = referer
+ def __init__(self, **kwargs):
super().__init__(**kwargs)
self.fields['first_name'].required = True
super().__init__(**kwargs)
self.fields['first_name'].required = True
@@
-83,11
+86,8
@@
class DonationStep2Form(forms.ModelForm, NewsletterForm):
c, key, (lambda k: lambda: self[k])(key)
))
c, key, (lambda k: lambda: self[k])(key)
))
-
-
def save(self, *args, **kwargs):
NewsletterForm.save(self, *args, **kwargs)
def save(self, *args, **kwargs):
NewsletterForm.save(self, *args, **kwargs)
- self.instance.source = self.referer or ''
instance = super().save(*args, **kwargs)
consents = []
instance = super().save(*args, **kwargs)
consents = []