Fixed #28415 -- Clarified what characters ASCII/UnicodeUsernameValidator accept.

This commit is contained in:
Tim Graham 2017-07-27 08:42:01 -04:00 committed by GitHub
parent 6ebe3a95ea
commit 14172cf442
2 changed files with 13 additions and 13 deletions

View File

@ -34,12 +34,12 @@ Fields
.. admonition:: Usernames and Unicode .. admonition:: Usernames and Unicode
Django originally accepted only ASCII letters in usernames. Django originally accepted only ASCII letters and numbers in
Although it wasn't a deliberate choice, Unicode characters have usernames. Although it wasn't a deliberate choice, Unicode
always been accepted when using Python 3. Django 1.10 officially characters have always been accepted when using Python 3. Django
added Unicode support in usernames, keeping the ASCII-only behavior 1.10 officially added Unicode support in usernames, keeping the
on Python 2, with the option to customize the behavior using ASCII-only behavior on Python 2, with the option to customize the
:attr:`.User.username_validator`. behavior using :attr:`.User.username_validator`.
.. attribute:: first_name .. attribute:: first_name
@ -395,12 +395,12 @@ Validators
.. class:: validators.ASCIIUsernameValidator .. class:: validators.ASCIIUsernameValidator
A field validator allowing only ASCII letters, in addition to ``@``, ``.``, A field validator allowing only ASCII letters and numbers, in addition to
``+``, ``-``, and ``_``. ``@``, ``.``, ``+``, ``-``, and ``_``.
.. class:: validators.UnicodeUsernameValidator .. class:: validators.UnicodeUsernameValidator
A field validator allowing Unicode letters, in addition to ``@``, ``.``, A field validator allowing Unicode characters, in addition to ``@``, ``.``,
``+``, ``-``, and ``_``. The default validator for ``User.username``. ``+``, ``-``, and ``_``. The default validator for ``User.username``.
.. _topics-auth-signals: .. _topics-auth-signals:

View File

@ -55,11 +55,11 @@ Official support for Unicode usernames
-------------------------------------- --------------------------------------
The :class:`~django.contrib.auth.models.User` model in ``django.contrib.auth`` The :class:`~django.contrib.auth.models.User` model in ``django.contrib.auth``
originally only accepted ASCII letters in usernames. Although it wasn't a originally only accepted ASCII letters and numbers in usernames. Although it
deliberate choice, Unicode characters have always been accepted when using wasn't a deliberate choice, Unicode characters have always been accepted when
Python 3. using Python 3.
The username validator now explicitly accepts Unicode letters by The username validator now explicitly accepts Unicode characters by
default on Python 3 only. This default behavior can be overridden by changing 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 :attr:`~django.contrib.auth.models.User.username_validator` attribute of
the ``User`` model, or to any proxy of that model, using either the ``User`` model, or to any proxy of that model, using either