Created
March 26, 2013 09:28
-
-
Save tuxcanfly/5244136 to your computer and use it in GitHub Desktop.
Django forms won't clean a second time.
This file contains 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
>>> from django.contrib.auth.forms import UserCreationForm | |
>>> form = UserCreationForm({'username': 'admin123', 'password1': 's3cr3t', 'password2': 's3cr3t'}) | |
>>> form.is_valid() | |
True | |
>>> form.data['username'] = '' | |
>>> form.is_valid() | |
True | |
>>> form._errors = None | |
>>> form.is_valid() | |
False | |
>>> form.errors | |
{'username': [u'This field is required.']} | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment