username
Required. 150 characters or fewer. Usernames may contain alphanumeric, _
, @
, +
, .
and -
characters.
The max_length
should be sufficient for many use cases. If you need a longer length, please use a custom user model. If you use MySQL with the utf8mb4
encoding (recommended for proper Unicode support), specify at most max_length=191
because MySQL can only create unique indexes with 191 characters in that case by default.
Usernames and Unicode
Django originally accepted only ASCII letters in 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 User.username_validator
.
The max_length
increased from 30 to 150 characters.
Please login to continue.