From 1e3727ec26c62498021dc1bdb9cb246756f91ba8 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Wed, 17 Apr 2024 14:34:51 +0200
Subject: [PATCH] fix submission form cleanup checks

---
 scipost_django/submissions/forms/__init__.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/scipost_django/submissions/forms/__init__.py b/scipost_django/submissions/forms/__init__.py
index a060c039d..ade3bc78d 100644
--- a/scipost_django/submissions/forms/__init__.py
+++ b/scipost_django/submissions/forms/__init__.py
@@ -1650,8 +1650,8 @@ class SubmissionForm(forms.ModelForm):
         at least one of the authors in the list is an expected author of the collection.
         """
         # Check if no collection is selected or fetch the object
-        collection_id = self.cleaned_data.get("collection", None)
-        if collection_id is None:
+        collection_id = self.cleaned_data.get("collection", "")
+        if collection_id == "":
             return
 
         collection = get_object_or_404(Collection, id=collection_id)
@@ -1783,9 +1783,8 @@ class SubmissionForm(forms.ModelForm):
         )
 
         # Save expectations
-        submission.fulfilled_expectations = ",".join(
-            self.cleaned_data["fulfilled_expectations"]
-        )
+        if fulfilled_expectations := self.cleaned_data.get("fulfilled_expectations"):
+            submission.fulfilled_expectations = fulfilled_expectations
 
         # Save identifiers
         url = ""
-- 
GitLab