Created
May 13, 2015 19:25
-
-
Save ashchristopher/2efcd1afc539975100a6 to your computer and use it in GitHub Desktop.
Django's ChoiceField error.
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
from django import forms | |
CHOICES = ( | |
('1', 1), | |
('2', 2), | |
('3', 3), | |
('4', 4), | |
('5', 5), | |
) | |
class BugForm(forms.Form): | |
days_since_last_bug = forms.TypedChoiceField(choices=CHOICES, coerce=long) | |
data = {'days_since_last_bug': '0', } | |
form = BugForm(data) | |
assert form.is_valid() == False, "0 should not be a valid choices for this field" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment