Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> from django import forms
- >>> class MyForm(forms.Form):
- ... int = forms.IntegerField()
- ...
- ...
- >>> form = MyForm(data={'int': 'asdf'})
- >>> form.is_valid()
- False
- >>> form.as_p()
- u'<ul class="errorlist"><li>Enter a whole number.</li></ul>\n<p><label for="id_int">Int:</label> <input id="id_int" name="int" type="number" value="asdf" /></p>'
- >>> form.data.pop('int')
- 'asdf'
- >>> form.as_p()
- u'<ul class="errorlist"><li>Enter a whole number.</li></ul>\n<p><label for="id_int">Int:</label> <input id="id_int" name="int" type="number" /></p>'
- >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement