[Django]-Validation of username with Django authenticate

4👍

Just add a method to your form:

def clean_username(self):
    username = self.cleaned_data.get('username')
    # do whatever checks you want and raise `ValidationError` if there's an issue
    return username

Leave a comment