Created
December 16, 2013 16:05
-
-
Save tijs/7989500 to your computer and use it in GitHub Desktop.
Prevent iOS (and maybe other mobile OSs as well) from auto capitalizing your username field, which in a standard Django auth setup would prevent these people from signing up with their uncapitalized username (or email for custom backends) when they try to login later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoginForm(AuthenticationForm): | |
""" Subclass the default AuthenticationForm and overwrite the username widget attributes """ | |
def __init__(self, *args, **kwargs): | |
super(LoginForm, self).__init__(*args, **kwargs) | |
self.fields['username'].widget.attrs.update({'autocapitalize':'off', 'autocorrect': 'off'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment