diff --git a/backend/pipeline/serializers/crud.py b/backend/pipeline/serializers/crud.py index e14c909a3..8278d0fa2 100644 --- a/backend/pipeline/serializers/crud.py +++ b/backend/pipeline/serializers/crud.py @@ -89,10 +89,11 @@ def create(self, validated_data: dict[str, Any]) -> Any: return super().create(validated_data) def save(self, **kwargs: Any) -> Pipeline: - if self.validated_data[PK.CRON_STRING]: - self.validated_data[PK.SCHEDULED] = True - else: - self.validated_data[PK.SCHEDULED] = False + if PK.CRON_STRING in self.validated_data: + if self.validated_data[PK.CRON_STRING]: + self.validated_data[PK.SCHEDULED] = True + else: + self.validated_data[PK.SCHEDULED] = False pipeline: Pipeline = super().save(**kwargs) if pipeline.cron_string is None: SchedulerHelper.remove_job(pipeline_id=str(pipeline.id))