- def clean(self):
- email = self.cleaned_data.get('email')
- try:
- subscription = Subscription.objects.get(email=email)
- except Subscription.DoesNotExist:
- raise ValidationError(ugettext(u'Email address not found.'))
- self.cleaned_data['subscription'] = subscription
-
- def save(self):
- subscription = self.cleaned_data['subscription']
- subscription.active = False
- subscription.save()
+ def __init__(self, newsletter, *args, **kwargs):
+ self.newsletter = newsletter
+ super(SubscribeForm, self).__init__(*args, **kwargs)