I\'m using Django allauth as my user account framework for my django site. The docs show there is an ACCOUNT_USERNAME_MIN_LENGTH however there is no ACCOUNT_USERNAME_MAX_L
Not sure if this is the best way but it works.
After extending the SignupForm
, Completely changed the username
field with a new one that has the max_length
parameter.
from django import forms
from django.utils.translation import ugettext_lazy as _
from allauth.account.forms import SignupForm
class AllauthSignupForm(SignupForm):
username = forms.CharField(label=_("Username"),
min_length=5,
max_length=20, # Change this
widget=forms.TextInput(
attrs={'placeholder':
_('Username'),
'autofocus': 'autofocus'}))