diff options
| author | Tim Graham <timograham@gmail.com> | 2016-06-21 09:06:34 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-06-21 16:20:00 -0400 |
| commit | 1b0b6f0342e5ac9e3e789ca522ad64a532602c3f (patch) | |
| tree | 2c7e2c58db94aa83cf8a692d339c4b2dd437980b /docs | |
| parent | 45a650777e4674bc540c3bf4b3108409f0e1f98a (diff) | |
[1.10.x] Refs #21379, #26719 -- Moved username normalization to AbstractBaseUser.
Thanks Huynh Thanh Tam for the initial patch and Claude Paroz for review.
Backport of 39805686b364358af725b695924a5a6dfa7f5302 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.10.txt | 4 | ||||
| -rw-r--r-- | docs/topics/auth/customizing.txt | 24 |
2 files changed, 20 insertions, 8 deletions
diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 752684e3fa..c56ac6efc6 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -887,6 +887,10 @@ Miscellaneous * Accessing a deleted field on a model instance, e.g. after ``del obj.field``, reloads the field's value instead of raising ``AttributeError``. +* If you subclass ``AbstractBaseUser`` and override ``clean()``, be sure it + calls ``super()``. :meth:`.AbstractBaseUser.normalize_username` is called in + a new :meth:`.AbstractBaseUser.clean` method. + .. _deprecated-features-1.10: Features deprecated in 1.10 diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt index d12fa6a212..6d84759831 100644 --- a/docs/topics/auth/customizing.txt +++ b/docs/topics/auth/customizing.txt @@ -612,6 +612,22 @@ The following attributes and methods are available on any subclass of Returns the value of the field nominated by ``USERNAME_FIELD``. + .. method:: clean() + + .. versionadded:: 1.10 + + Normalizes the username by calling :meth:`normalize_username`. If you + override this method, be sure to call ``super()`` to retain the + normalization. + + .. classmethod:: normalize_username(username) + + .. versionadded:: 1.10 + + Applies NFKC Unicode normalization to usernames so that visually + identical characters with different Unicode code points are considered + identical. + .. attribute:: models.AbstractBaseUser.is_authenticated Read-only attribute which is always ``True`` (as opposed to @@ -726,14 +742,6 @@ utility methods: Normalizes email addresses by lowercasing the domain portion of the email address. - .. classmethod:: models.BaseUserManager.normalize_username(email) - - .. versionadded:: 1.10 - - Applies NFKC Unicode normalization to usernames so that visually - identical characters with different Unicode code points are considered - identical. - .. method:: models.BaseUserManager.get_by_natural_key(username) Retrieves a user instance using the contents of the field |
