Esempio n. 1
0
 def clean_username(self):
     """Make sure that username has no invalid characters."""
     username = self.cleaned_data['username']
     slug_validator(username, lower=False)
     if username == 'admin':
         self._errors['username'] = forms.util.ErrorList([
             _('Please choose another username.')])
     return username
Esempio n. 2
0
 def clean(self, value):
     super(UsernameField, self).clean(value)
     slug_validator(value, lower=False)
     try:
         func, args, kwargs = urlresolvers.resolve("/%s/" % (value,))
         if callable(func) and args == ():
             if 'username' not in kwargs.keys():
                 raise forms.ValidationError(
                     _('Please choose another username.'))
     except urlresolvers.Resolver404:
         pass
     return value
Esempio n. 3
0
 def clean(self, value):
     super(UsernameField, self).clean(value)
     slug_validator(value, lower=False)
     try:
         func, args, kwargs = urlresolvers.resolve("/%s/" % (value, ))
         if callable(func) and args == ():
             if 'username' not in kwargs.keys():
                 raise forms.ValidationError(
                     _('Please choose another username.'))
     except urlresolvers.Resolver404:
         pass
     return value
Esempio n. 4
0
 def clean(self, value):
     super(UsernameField, self).clean(value)
     slug_validator(value, lower=False)
     try:
         func, args, kwargs = urlresolvers.resolve("/%s/" % (value,))
         if callable(func) and args == ():
             if "username" not in kwargs.keys():
                 raise forms.ValidationError(_("Please choose another username."))
     except urlresolvers.Resolver404:
         pass
     if value in settings.INVALID_USERNAMES:
         raise forms.ValidationError(_("Please choose another username."))
     return value
Esempio n. 5
0
 def clean_username(self):
     """Make sure that username has no invalid characters."""
     username = self.cleaned_data['username']
     slug_validator(username, lower=False)
     return username