From cb22eb348db4e4258960abfa0edb86a43a71b41e Mon Sep 17 00:00:00 2001 From: tcely Date: Mon, 14 Apr 2025 18:12:33 -0400 Subject: [PATCH] Additions from the rest container --- tubesync/sync/fields.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tubesync/sync/fields.py b/tubesync/sync/fields.py index 11adb5e2..9f90a362 100644 --- a/tubesync/sync/fields.py +++ b/tubesync/sync/fields.py @@ -129,8 +129,13 @@ class CommaSepChoiceField(models.CharField): ''' 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: value = value.split(self.separator) + # empty string and None, or whatever if not isinstance(value, list): value = list() self.selected_choices = value @@ -161,6 +166,8 @@ class CommaSepChoiceField(models.CharField): # extra functions not used by any parent classes @staticmethod def _tuple__str__(data): + if not isinstance(data, CommaSepChoice): + return data value = data.selected_choices if not isinstance(value, list): return ''