Ticket #3129: multiple_choice_tests.patch

File multiple_choice_tests.patch, 953 bytes (added by Massimiliano Ravelli, 18 years ago)
  • tests/regressiontests/forms/tests.py

     
    16721672<li><label><input checked="checked" type="checkbox" name="composers" value="P" /> Paul McCartney</label></li>
    16731673</ul>
    16741674
     1675>>> data = dict(name='Yesterday', composers=['J', 'P'])
     1676>>> f = SongForm(data)
     1677>>> f.errors
     1678{}
     1679
     1680>>> from django.http import QueryDict
     1681>>> data = QueryDict('name=Yesterday&composers=J&composers=P')
     1682>>> f = SongForm(data)
     1683>>> f.errors
     1684{}
     1685
     1686>>> from django.utils.datastructures import MultiValueDict
     1687>>> data = MultiValueDict(dict(name='Yesterday', composers=['J', 'P']))
     1688>>> f = SongForm(data)
     1689>>> f.errors
     1690{}
     1691
    16751692When using CheckboxSelectMultiple, the framework expects a list of input and
    16761693returns a list of input.
    16771694>>> f = SongForm({'name': 'Yesterday'}, auto_id=False)
Back to Top