1 2 3 4 5 6 | # better solution proposed by KpoH:
from django.forms.fields import email_re
def is_valid_email(email):
return True if email_re.match(email) else False
|
More like this
- MultipleEmailsField by spanasik 4 years ago
- Make hyperlinks for labels of raw_id_fields (jQuery) by ramen 3 years, 4 months ago
- FuzzyDateTimeField by japerk 4 years, 1 month ago
- Confirm alert if the user navigates away without saving changes by mrazzari 3 years, 10 months ago
- Decoupling models with cross-database relations by zvikico 2 years, 3 months ago
Comments
better solution
#
even better :)
or
#
hey there thanks.
can you please repost that in a new snippet?
just realized my code is not even working properly.
sorry about that
#
nevermind about reposting, i just put in your code
#
This is cleaner:
but a function is redundant, instead of calling it each time, one can simply do:
#
Just a note for those on Django 1.1.1 or higher having trouble getting this to work...
The location of the regular expression has moved to:
#