MCPcopy
hub / github.com/django/django / normalize_email

Method normalize_email

django/contrib/auth/base_user.py:23–34  ·  view source on GitHub ↗

Normalize the email address by lowercasing the domain part of it.

(cls, email)

Source from the content-addressed store, hash-verified

21class BaseUserManager(models.Manager):
22 @classmethod
23 def normalize_email(cls, email):
24 """
25 Normalize the email address by lowercasing the domain part of it.
26 """
27 email = email or ""
28 try:
29 email_name, domain_part = email.strip().rsplit("@", 1)
30 except ValueError:
31 pass
32 else:
33 email = email_name + "@" + domain_part.lower()
34 return email
35
36 def get_by_natural_key(self, username):
37 return self.get(**{self.model.USERNAME_FIELD: username})

Calls

no outgoing calls