Commit 30047d39 authored by Michal Čihař's avatar Michal Čihař

Better error message for invalid username (issue #254)

parent a5512312
......@@ -211,6 +211,18 @@ class RegistrationForm(RegistrationFormUniqueEmail):
Registration form, please note it does not save first/last name
this is done by signal handler in accounts.models.
'''
username = forms.RegexField(
regex=r'^[\w.@+-]+$',
max_length=30,
widget=forms.TextInput(attrs=attrs_dict),
label=_("Username"),
error_messages={
'invalid': _(
'This value may contain only letters, '
'numbers and following characters: @ . + - _'
)
}
)
first_name = forms.CharField(label=_('First name'))
last_name = forms.CharField(label=_('Last name'))
content = forms.CharField(required=False)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment