Ticket #3114: multiple_choice_4194.patch

File multiple_choice_4194.patch, 1.5 KB (added by Honza Král <Honza.Kral@…>, 18 years ago)

patch against version 4194

  • django/newforms/forms.py

     
    22Form classes
    33"""
    44
    5 from django.utils.datastructures import SortedDict
     5from django.utils.datastructures import SortedDict, MultiValueDict
    66from django.utils.html import escape
    77from fields import Field
    88from widgets import TextInput, Textarea, HiddenInput
     
    221221
    222222    def _data(self):
    223223        "Returns the data for this BoundField, or None if it wasn't given."
     224        if isinstance(self.form.data, MultiValueDict) and self.field.widget.requires_data_list:
     225            return self.form.data.getlist(self.name)
    224226        return self.form.data.get(self.name, None)
    225227    data = property(_data)
    226228
  • django/newforms/widgets.py

     
    1010
    1111from util import StrAndUnicode, smart_unicode
    1212from django.utils.html import escape
     13from django.utils.datastructures import MultiValueDict
    1314from itertools import chain
    1415
    1516try:
     
    4344        Given a dictionary of data and this widget's name, returns the value
    4445        of this widget. Returns None if it's not provided.
    4546        """
     47        if isinstance(data, MultiValueDict) and self.requires_data_list:
     48            return data.getlist(name)
    4649        return data.get(name, None)
    4750
    4851    def id_for_label(self, id_):
Back to Top