Kaydet (Commit) fb2b4253 authored tarafından Tim Graham's avatar Tim Graham

[2.1.x] Refs #27807 -- Removed docs for User.username_validator.

The new override functionality claimed in refs #21379 doesn't work.
Forwardport of 714fdbaa from stable/1.10.x.
üst 0a8617a5
......@@ -38,8 +38,7 @@ Fields
usernames. Although it wasn't a deliberate choice, Unicode
characters have always been accepted when using Python 3. Django
1.10 officially added Unicode support in usernames, keeping the
ASCII-only behavior on Python 2, with the option to customize the
behavior using :attr:`.User.username_validator`.
ASCII-only behavior on Python 2.
.. attribute:: first_name
......@@ -141,24 +140,6 @@ Attributes
:attr:`~django.contrib.auth.models.User.is_authenticated` to this
attribute.
.. attribute:: username_validator
Points to a validator instance used to validate usernames. Defaults to
:class:`validators.UnicodeUsernameValidator`.
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::
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
-------
......
......@@ -60,12 +60,11 @@ wasn't a deliberate choice, Unicode characters have always been accepted when
using Python 3.
The username validator now explicitly accepts Unicode characters by
default on Python 3 only. This default behavior can be overridden by changing
the :attr:`~django.contrib.auth.models.User.username_validator` attribute of
the ``User`` model, or to any proxy of that model, using either
default on Python 3 only.
Custom user models may use the new
:class:`~django.contrib.auth.validators.ASCIIUsernameValidator` or
:class:`~django.contrib.auth.validators.UnicodeUsernameValidator`. Custom user
models may also use those validators.
:class:`~django.contrib.auth.validators.UnicodeUsernameValidator`.
Minor features
--------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment