- Author:
- flavio87
- Posted:
- September 29, 2008
- Language:
- Python
- Version:
- 1.0
- Score:
- 2 (after 2 ratings)
This very basic function I was missing in this part of the Django Documentation when creating a custom MultiEmailField: http://docs.djangoproject.com/en/dev/ref/forms/validation/
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
- Template tag - list punctuation for a list of items by shapiromatron 10 months, 1 week ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 2 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
- Help text hyperlinks by sa2812 1 year, 6 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:
#
Please login first before commenting.