[1.10.x] Refs #27807 -- Removed docs for User.username_validator.
The new override functionality claimed in refs #21379 doesn't work.
This commit is contained in:
parent
5418af7a78
commit
714fdbaa70
|
@ -38,8 +38,7 @@ Fields
|
||||||
Although it wasn't a deliberate choice, Unicode characters have
|
Although it wasn't a deliberate choice, Unicode characters have
|
||||||
always been accepted when using Python 3. Django 1.10 officially
|
always been accepted when using Python 3. Django 1.10 officially
|
||||||
added Unicode support in usernames, keeping the ASCII-only behavior
|
added Unicode support in usernames, keeping the ASCII-only behavior
|
||||||
on Python 2, with the option to customize the behavior using
|
on Python 2.
|
||||||
:attr:`.User.username_validator`.
|
|
||||||
|
|
||||||
.. versionchanged:: 1.10
|
.. versionchanged:: 1.10
|
||||||
|
|
||||||
|
@ -155,27 +154,6 @@ Attributes
|
||||||
In older versions, this was a method. Backwards-compatibility
|
In older versions, this was a method. Backwards-compatibility
|
||||||
support for using it as a method will be removed in Django 2.0.
|
support for using it as a method will be removed in Django 2.0.
|
||||||
|
|
||||||
.. attribute:: username_validator
|
|
||||||
|
|
||||||
.. versionadded:: 1.10
|
|
||||||
|
|
||||||
Points to a validator instance used to validate usernames. Defaults to
|
|
||||||
:class:`validators.UnicodeUsernameValidator` on Python 3 and
|
|
||||||
:class:`validators.ASCIIUsernameValidator` on Python 2.
|
|
||||||
|
|
||||||
To change the default username validator, you can subclass the ``User``
|
|
||||||
model and set this attribute to a different validator instance. For
|
|
||||||
example, to use ASCII usernames on Python 3::
|
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.contrib.auth.validators import ASCIIUsernameValidator
|
|
||||||
|
|
||||||
class CustomUser(User):
|
|
||||||
username_validator = ASCIIUsernameValidator()
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
proxy = True # If no new field is added.
|
|
||||||
|
|
||||||
Methods
|
Methods
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -60,12 +60,11 @@ deliberate choice, Unicode characters have always been accepted when using
|
||||||
Python 3.
|
Python 3.
|
||||||
|
|
||||||
The username validator now explicitly accepts Unicode letters by
|
The username validator now explicitly accepts Unicode letters by
|
||||||
default on Python 3 only. This default behavior can be overridden by changing
|
default on Python 3 only.
|
||||||
the :attr:`~django.contrib.auth.models.User.username_validator` attribute of
|
|
||||||
the ``User`` model, or to any proxy of that model, using either
|
Custom user models may use the new
|
||||||
:class:`~django.contrib.auth.validators.ASCIIUsernameValidator` or
|
:class:`~django.contrib.auth.validators.ASCIIUsernameValidator` or
|
||||||
:class:`~django.contrib.auth.validators.UnicodeUsernameValidator`. Custom user
|
:class:`~django.contrib.auth.validators.UnicodeUsernameValidator`.
|
||||||
models may also use those validators.
|
|
||||||
|
|
||||||
Minor features
|
Minor features
|
||||||
--------------
|
--------------
|
||||||
|
|
Loading…
Reference in New Issue