Ticket #6733: field_testcase.py
File field_testcase.py, 400 bytes (added by , 17 years ago) |
---|
Line | |
---|---|
1 | from django import newforms as forms |
2 | |
3 | CHOICES = [(choi, choi) for choi in "One Two".split()] |
4 | |
5 | class TestForm(forms.Form): |
6 | number = forms.MultipleChoiceField(choices=CHOICES, required=False) |
7 | |
8 | foo = TestForm(dict(number=['One'])) |
9 | print foo |
10 | assert 'selected="selected"' in str(foo) |
11 | |
12 | bar = TestForm(dict(number=['One']), prefix="mypre") |
13 | print bar |
14 | # Fails... |
15 | assert 'selected="selected"' in str(bar) |
16 |