mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 01:48:21 +02:00
Allow users to have complicated username
This commit is contained in:
@ -20,6 +20,19 @@ class CustomAuthenticationForm(AuthenticationForm):
|
||||
)
|
||||
|
||||
|
||||
class UserForm(forms.ModelForm):
|
||||
def _get_validation_exclusions(self):
|
||||
# Django usernames can only contain letters, numbers, @, ., +, - and _.
|
||||
# We want to allow users to have uncommon and unpractical usernames:
|
||||
# That is their problem, and we have normalized aliases for us.
|
||||
return super()._get_validation_exclusions() + ["username"]
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ('first_name', 'last_name', 'username', 'email',)
|
||||
|
||||
|
||||
|
||||
class ProfileForm(forms.ModelForm):
|
||||
"""
|
||||
A form for the extras field provided by the :model:`member.Profile` model.
|
||||
|
Reference in New Issue
Block a user