diff --git a/emencia/django/newsletter/forms.py b/emencia/django/newsletter/forms.py index 41d58d9e..6b9f66de 100644 --- a/emencia/django/newsletter/forms.py +++ b/emencia/django/newsletter/forms.py @@ -45,6 +45,12 @@ class AutomaticEmailTestForm(forms.Form): 'placeholder': _(u'дд.мм.гггг')})) email = forms.EmailField(label=_(u'Email')) + def clean_email(self): + try: + Contact.objects.get(email=self.cleaned_data['email']) + except (Contact.DoesNotExist, ) as e: + raise ValidationError(_(u'Контакта с таким емейлом не существует')) + return self.cleaned_data['email'] class MailingListSubscriptionForm(forms.ModelForm): """Form for subscribing to a mailing list""" diff --git a/fabfile.py b/fabfile.py index 09c48084..7edaf533 100644 --- a/fabfile.py +++ b/fabfile.py @@ -126,6 +126,7 @@ def pull(with_configs=False, func=None): put_configs() if func is not None and func in tickets and callable(tickets[func]): tickets[func]() + run('python manage.py migrate') call_state('start', only='apache2')