X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c159744a19d4619f1bf08d40d5f69aab91817b6a..d454277a61e2f34e34ee87777b0d35724edf877e:/apps/suggest/forms.py?ds=inline diff --git a/apps/suggest/forms.py b/apps/suggest/forms.py index 1a5554336..b98e0ae4a 100644 --- a/apps/suggest/forms.py +++ b/apps/suggest/forms.py @@ -4,9 +4,10 @@ # from django import forms from django.contrib.sites.models import Site +from django.core.exceptions import ValidationError from django.core.mail import send_mail, mail_managers from django.core.urlresolvers import reverse -from django.core.validators import email_re +from django.core.validators import validate_email from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext from suggest.models import PublishingSuggestion, Suggestion @@ -41,7 +42,11 @@ Kontakt: %(contact)s 'description': description, }, fail_silently=True) - if email_re.match(contact): + try: + validate_email(contact) + except ValidationError: + pass + else: send_mail(u'[WolneLektury] ' + ugettext(u'Thank you for your suggestion.'), ugettext(u"""\ @@ -96,7 +101,11 @@ Audiobooki: 'audiobooks': audiobooks, }, fail_silently=True) - if email_re.match(contact): + try: + validate_email(contact) + except ValidationError: + pass + else: send_mail(u'[WolneLektury] ' + ugettext(u'Thank you for your suggestion.'), ugettext(u"""\