Ticket #11644: fields.py.diff

File fields.py.diff, 729 bytes (added by gruszczy, 6 years ago)
  • fields.py

     
    634634    def _get_choices(self):
    635635        return self._choices
    636636
    637     def _set_choices(self, value):
     637    def _set_choices(self, choices):
    638638        # Setting choices also sets the choices on the widget.
    639639        # choices can be any iterable, but we call list() on it because
    640640        # it will be consumed more than once.
    641         self._choices = self.widget.choices = list(value)
     641        self._choices = self.widget.choices = [choice if isinstance(choice, tuple) else (choice, choice) for choice in choices]
    642642
    643643    choices = property(_get_choices, _set_choices)
    644644
Back to Top