1 # -*- coding: utf-8 -*-
3 from django.forms import Form, BooleanField
4 from django.utils.translation import ugettext_lazy as _
6 from newsletter.models import Subscription
9 class NewsletterForm(Form):
11 agree_newsletter = BooleanField(required=False, label=_(u'I want to receive Wolne Lektury\'s newsletter.'))
15 # multiple inheritance mode
16 super(NewsletterForm, self).save()
17 except AttributeError:
19 email = self.cleaned_data[self.email_field]
20 subscription, created = Subscription.objects.get_or_create(email=email)
21 if not created and not subscription.active:
22 subscription.active = True
24 # Send some test email?