diff --git a/catalog/common/jsondata.py b/catalog/common/jsondata.py index 9b59d9f2..299560e0 100644 --- a/catalog/common/jsondata.py +++ b/catalog/common/jsondata.py @@ -237,8 +237,9 @@ class ArrayField(JSONFieldMixin, DJANGO_ArrayField): super().__init__(*args, **kwargs) def from_json(self, value): # backward compatible with dirty legacy data - if value or value == []: + if value: return value if isinstance(value, list) else [value] + return [] class JSONField(JSONFieldMixin, DJANGO_JSONField): diff --git a/catalog/tv/tests.py b/catalog/tv/tests.py index 956e536b..1ec00ede 100644 --- a/catalog/tv/tests.py +++ b/catalog/tv/tests.py @@ -12,7 +12,7 @@ class JSONFieldTestCase(TestCase): o.other_title = ["a", "b"] self.assertEqual(o.other_title, ["a", "b"]) o.other_title = None - self.assertEqual(o.other_title, None) + self.assertEqual(o.other_title, []) class TMDBTVTestCase(TestCase):