X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/64d26c022dc182339b33c3cd8e4ef1978b150573..9bc86f5a6542c5893ac94284da33162a7c7be2d6:/src/newsletter/forms.py
diff --git a/src/newsletter/forms.py b/src/newsletter/forms.py
index ba086e352..edfaab6f7 100644
--- a/src/newsletter/forms.py
+++ b/src/newsletter/forms.py
@@ -6,7 +6,7 @@ from django.core.validators import validate_email
from django.forms import Form, BooleanField
from django.forms.fields import EmailField
from django.utils.safestring import mark_safe
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from newsletter.subscribe import subscribe
from .models import Newsletter
@@ -14,19 +14,27 @@ from .models import Newsletter
class NewsletterForm(Form):
email_field = 'email'
agree_newsletter = BooleanField(
- required=False, initial=False, label=_('I want to receive Wolne Lektury\'s newsletter.'))
+ required=False, initial=False, label=_('I want to receive Wolne Lektury\'s newsletter.'), label_suffix=False)
mailing = False
mailing_field = 'agree_newsletter'
newsletter = None
data_processing_part1 = '''\
-Administratorem danych osobowych jest Fundacja Nowoczesna Polska (ul. MarszaÅkowska 84/92 lok. 125, 00-514 Warszawa).
+Administratorem danych osobowych jest Fundacja Wolne Lektury (ul. MarszaÅkowska 84/92 lok. 125, 00-514 Warszawa).
Podanie danych osobowych jest dobrowolne.'''
data_processing_part2 = '''Dane sÄ
przetwarzane w zakresie niezbÄdnym do wysyÅania newslettera odbiorcom.'''
data_processing_part3 = '''\
Osobom, których dane sÄ
zbierane, przysÅuguje prawo dostÄpu do treÅci swoich danych oraz ich poprawiania.
-WiÄcej informacji w polityce prywatnoÅci.'''
+WiÄcej informacji w polityce prywatnoÅci.'''
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ # Move the newsletter field to the end.
+ if 'agree_newsletter' in self.fields:
+ f = self.fields['agree_newsletter']
+ del self.fields['agree_newsletter']
+ self.fields['agree_newsletter'] = f
+
@property
def data_processing(self):
return mark_safe('%s %s %s' % (self.data_processing_part1, self.data_processing_part2, self.data_processing_part3))
@@ -36,11 +44,6 @@ WiÄcej informacji w polityce prywatnoÅci.'''
if not newsletter:
return
- try:
- # multiple inheritance mode
- super(NewsletterForm, self).save(*args, **kwargs)
- except AttributeError:
- pass
if not (self.mailing or self.cleaned_data.get(self.mailing_field)):
return
email = self.cleaned_data[self.email_field]
@@ -55,6 +58,7 @@ WiÄcej informacji w polityce prywatnoÅci.'''
class SubscribeForm(NewsletterForm):
mailing = True
agree_newsletter = None
+ required_css_class = 'required'
email = EmailField(label=_('email address'))