Skip to content

Instantly share code, notes, and snippets.

@pareksha
Last active January 8, 2019 11:08
Show Gist options
  • Save pareksha/7479852a5a71a1e5a0f05e9504306354 to your computer and use it in GitHub Desktop.
Save pareksha/7479852a5a71a1e5a0f05e9504306354 to your computer and use it in GitHub Desktop.
Easy email validation in django.
from django.core.validators import ValidationError
try:
validate_email(email)
except ValidationError:
return Response({"status": "error", "message": "Provided email id is invalid."})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment