Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#21735 closed Bug (duplicate)

username field uniqueness check should be optional

Reported by: Chris Jerdonek Owned by: nobody
Component: Core (Management commands) Version: 1.6
Severity: Normal Keywords:
Cc: chris.jerdonek@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently, Django doesn't let you have a username field with unique=False. This limitation was imposed recently in issue #19822.

I think this limitation should be lifted.

In my use case, email address is the username field, and I would like a user account to be considered active only after the signup has been validated via email. To handle this use case, it is natural to add the account info to the user table when someone tries to sign up, and then activate that row only when the user clicks the corresponding validation link. This is essentially what django-registration does in its two-phase registration workflow, with minor variations.

However, with this use case, there are edge cases where the same email address can exist unregistered in the database more than once. Instead, with this process the unique index should be on a pair of columns to enforce the fact that each email address should be in the database only once -- when restricted to active user accounts.

Change History (3)

comment:1 Changed 4 years ago by Chris Jerdonek

Cc: chris.jerdonek@… added

comment:2 Changed 4 years ago by Chris Jerdonek

I discovered that this is a duplicate of issue #19844.

Last edited 4 years ago by Chris Jerdonek (previous) (diff)

comment:3 Changed 4 years ago by Chris Jerdonek

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top