mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
createsuperuser and how it relates to email-based addresses: document
chaning actual createsuperuser behavior is usually done using the USERNAME_FIELD but that field has other repurcussions (that we don't want) too
This commit is contained in:
@@ -21,6 +21,11 @@ UserModel = get_user_model()
|
||||
|
||||
class UserCreationForm(BaseUserCreationForm):
|
||||
|
||||
# Our UserCreationForm is the place where the "use email for usernames" logic is implemented.
|
||||
# We could instead push such logic in the model, and do it more thoroughly (i.e. remove either field, and point the
|
||||
# USERNAME_FIELD to the other). But I'm not sure that this is the most future-proof way forward. In particular,
|
||||
# external systems (AD, OAuth, etc.) may have 2 fields rather than 1.
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['username'].validators = [EmailValidator()]
|
||||
|
||||
Reference in New Issue
Block a user