mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 14:36:34 +00:00
Additions from the rest container
This commit is contained in:
parent
debac50ca3
commit
cb22eb348d
@ -129,8 +129,13 @@ class CommaSepChoiceField(models.CharField):
|
|||||||
'''
|
'''
|
||||||
Create a data structure to be used in Python code.
|
Create a data structure to be used in Python code.
|
||||||
'''
|
'''
|
||||||
|
# possibly not useful?
|
||||||
|
if isinstance(value, CommaSepChoice):
|
||||||
|
value = value.selected_choices
|
||||||
|
# normally strings
|
||||||
if isinstance(value, str) and len(value) > 0:
|
if isinstance(value, str) and len(value) > 0:
|
||||||
value = value.split(self.separator)
|
value = value.split(self.separator)
|
||||||
|
# empty string and None, or whatever
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
value = list()
|
value = list()
|
||||||
self.selected_choices = value
|
self.selected_choices = value
|
||||||
@ -161,6 +166,8 @@ class CommaSepChoiceField(models.CharField):
|
|||||||
# extra functions not used by any parent classes
|
# extra functions not used by any parent classes
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _tuple__str__(data):
|
def _tuple__str__(data):
|
||||||
|
if not isinstance(data, CommaSepChoice):
|
||||||
|
return data
|
||||||
value = data.selected_choices
|
value = data.selected_choices
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
return ''
|
return ''
|
||||||
|
Loading…
Reference in New Issue
Block a user