Support for named groups in choices
This commit is contained in:
parent
59b83db9f8
commit
203411c3cf
|
@ -61,7 +61,13 @@ class MultiSelectField(models.CharField):
|
|||
return self.get_choices(include_blank=False)
|
||||
|
||||
def get_choices_selected(self, arr_choices):
|
||||
named_groups = arr_choices and isinstance(arr_choices[0][1], (list, tuple))
|
||||
choices_selected = []
|
||||
if named_groups:
|
||||
for choice_group_selected in arr_choices:
|
||||
for choice_selected in choice_group_selected[1]:
|
||||
choices_selected.append(string_type(choice_selected[0]))
|
||||
else:
|
||||
for choice_selected in arr_choices:
|
||||
choices_selected.append(string_type(choice_selected[0]))
|
||||
return choices_selected
|
||||
|
|
Loading…
Reference in a new issue