예제 #1
0
 def clean_username(self, username):
     print('THIS IS A TEST OF CLEAN USERNAME')
     if len(username) > 0:
         raise ValidationError(
             'Please enter a username value less than the current one')
     return DefaultAccountAdapter.clean_username(
         self, username)  # For other default validations.
예제 #2
0
    def clean_username(self, username):
        if len(username) > USERNAME_MAX_LENGTH:
            raise ValidationError(
                f'Please enter a username less than {USERNAME_MAX_LENGTH + 1}')

        # For other default validations.
        return DefaultAccountAdapter.clean_username(self, username)
예제 #3
0
    def clean_username(self, username, shallow=None):
        print("aaaa", type(len(username)))
        if len(username) > 30:
            raise ValidationError(
                'Please enter a username value less than the current one')

        # For other default validations.
        return DefaultAccountAdapter.clean_username(self, username)
예제 #4
0
    def clean_username(self, username, shallow=False):
        zh_pattern = re.compile(u'[\u4e00-\u9fa5]+')
        username = str(username)                  
        result = zh_pattern.search(username)
        if result:
            raise forms.ValidationError(('用户名不能为中文'),code = 'invalid')

        return DefaultAccountAdapter.clean_username(self, username, shallow=shallow)
예제 #5
0
    def clean_username(self, username):
        if len(username) > 20:
            raise ValidationError(
                'Please enter a username value less than the current one')
        return DefaultAccountAdapter.clean_username(self, username)


# class RestrictEmailAdapter(DefaultAccountAdapter):
#     def clean_email(self,email):
#         RestrictedList = ['Your restricted list goes here.']
#         if email in RestrictedList
#             raise ValidationError('You are restricted from registering. Please contact admin.')
#         return email
예제 #6
0
 def clean_username(self, username):
     if len(username) > 8:
         raise ValidationError(
             'Please enter a username value less than the current one')
     # For other default validations.
     return DefaultAccountAdapter.clean_username(self, username)
예제 #7
0
 def clean_username(self, username, shallow=False):
     if len(username) >= 15:
         raise ValidationError(
             'Please enter a username less than 15 characters')
     return DefaultAccountAdapter.clean_username(
         self, username)  # For other default validations.
예제 #8
0
    def clean_username(self, username):
        if len(username) > settings.USERNAME_MAX_LENGTH:
            raise ValidationError('Max username length is eight charactors')

        # For other default validations.
        return DefaultAccountAdapter.clean_username(self, username)
예제 #9
0
 def clean_username(self, username):
     if len(username) > 10:
         raise ValidationError(
             "Please enter an username of maximum 10 characters")
     return DefaultAccountAdapter.clean_username(self, username)