username field uniqueness check should be optional
|Reported by:||cjerdonek||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||1.6|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||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 23 months ago by cjerdonek
- Cc chris.jerdonek@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset