Refactor get_choices_selected
This commit is contained in:
parent
dd7ff42d24
commit
945f37fddf
1 changed files with 4 additions and 6 deletions
|
@ -60,13 +60,11 @@ class MultiSelectField(models.CharField):
|
||||||
def get_choices_default(self):
|
def get_choices_default(self):
|
||||||
return self.get_choices(include_blank=False)
|
return self.get_choices(include_blank=False)
|
||||||
|
|
||||||
def get_choices_selected(self, arr_choices=None):
|
def get_choices_selected(self, arr_choices):
|
||||||
if arr_choices is None:
|
choices_selected = []
|
||||||
return False
|
|
||||||
list = []
|
|
||||||
for choice_selected in arr_choices:
|
for choice_selected in arr_choices:
|
||||||
list.append(string_type(choice_selected[0]))
|
choices_selected.append(string_type(choice_selected[0]))
|
||||||
return list
|
return choices_selected
|
||||||
|
|
||||||
def value_to_string(self, obj):
|
def value_to_string(self, obj):
|
||||||
value = self._get_val_from_obj(obj)
|
value = self._get_val_from_obj(obj)
|
||||||
|
|
Loading…
Reference in a new issue