From 593c4366b5e5177a984ac02dec8d2c69957a350a Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Mon, 25 Mar 2024 18:15:34 -0400
Subject: [PATCH] fix: work around the validation for cbaSeriesIs &
 defaultPlaylistId

Closes #178
---
 program/serializers.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/program/serializers.py b/program/serializers.py
index 04db8b51..e1519964 100644
--- a/program/serializers.py
+++ b/program/serializers.py
@@ -558,6 +558,16 @@ class ShowSerializer(serializers.HyperlinkedModelSerializer):
             "type_id",
         ) + read_only_fields
 
+    @staticmethod
+    def validate_cba_series_id(value):
+        # FIXME: ugly hack to capture 0 as None
+        return None if value == 0 else value
+
+    @staticmethod
+    def validate_default_playlist_id(value):
+        # FIXME: ugly hack to capture 0 as None
+        return None if value == 0 else value
+
     def create(self, validated_data):
         """
         Create and return a new Show instance, given the validated data.
-- 
GitLab