username = models.CharField(
_('username'),
max_length=30,
unique=True,
help_text=_('Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.'),
validators=[
validators.RegexValidator(
r'^[\w.+-]+$',
_('Enter a valid username. This value may contain only '
'letters, numbers ' 'and ./+/-/_ characters.')
),
],
error_messages={
'unique': _("A user with that username already exists."),
},
)
I've configured user's username field in following way
username = models.CharField(
_('username'),
max_length=30,
unique=True,
help_text=_('Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.'),
validators=[
validators.RegexValidator(
r'^[\w.+-]+$',
_('Enter a valid username. This value may contain only '
'letters, numbers ' 'and ./+/-/_ characters.')
),
],
error_messages={
'unique': _("A user with that username already exists."),
},
)I'm getting error in admin panel but not in django-shell.
Though django raises an error for maximum length in shell.Is it a bug? Or am I missing something.