Code

Ticket #11644: fields.py.diff

File fields.py.diff, 729 bytes (added by gruszczy, 5 years ago)
Line 
1Index: fields.py
2===================================================================
3--- fields.py   (wersja 11410)
4+++ fields.py   (kopia robocza)
5@@ -634,11 +634,11 @@
6     def _get_choices(self):
7         return self._choices
8 
9-    def _set_choices(self, value):
10+    def _set_choices(self, choices):
11         # Setting choices also sets the choices on the widget.
12         # choices can be any iterable, but we call list() on it because
13         # it will be consumed more than once.
14-        self._choices = self.widget.choices = list(value)
15+        self._choices = self.widget.choices = [choice if isinstance(choice, tuple) else (choice, choice) for choice in choices]
16 
17     choices = property(_get_choices, _set_choices)
18