Re: [Django] #36225: USERNAME_FIELD must be unique in order to use createsuperuser command (was: User profile models with nullable emails cannot use createsuperuser command)

2 views
Skip to first unread message

Django

unread,
Mar 11, 2025, 4:39:51 AMMar 11
to django-...@googlegroups.com
#36225: USERNAME_FIELD must be unique in order to use createsuperuser command
--------------------------------------+------------------------------------
Reporter: Jonas Dittrich | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: contrib.auth | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sarah Boyce):

* component: Uncategorized => contrib.auth
* stage: Unreviewed => Accepted
* summary:
User profile models with nullable emails cannot use createsuperuser
command
=> USERNAME_FIELD must be unique in order to use createsuperuser
command
* type: Uncategorized => Cleanup/optimization

Comment:

Based off the forum thread, the confusion here I see is from the
[https://docs.djangoproject.com/en/5.1/topics/auth/customizing/#django.contrib.auth.models.CustomUser.USERNAME_FIELD
USERNAME_FIELD docs] saying:

> The field must be unique (e.g. have unique=True set in its definition),
unless you use a custom authentication backend that can support non-unique
usernames.

I think we could remove the "unless you use a custom authentication
backend that can support non-unique usernames." because it implies we
support this use case.
Accepting for Documentation tweaks
--
Ticket URL: <https://code.djangoproject.com/ticket/36225#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages