From 02320ce669e3e29b7cdba3a832e42214bb2d02ee Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Thu, 11 Apr 2024 12:20:17 +0200 Subject: [PATCH] force collection cleaning after authors --- scipost_django/submissions/forms/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scipost_django/submissions/forms/__init__.py b/scipost_django/submissions/forms/__init__.py index 5fce00538..5b3da2a40 100644 --- a/scipost_django/submissions/forms/__init__.py +++ b/scipost_django/submissions/forms/__init__.py @@ -1536,6 +1536,8 @@ class SubmissionForm(forms.ModelForm): """ cleaned_data = super().clean(*args, **kwargs) + self._clean_collection() + # SciPost preprints are auto-generated here. if "identifier_w_vn_nr" not in cleaned_data: cleaned_data["identifier_w_vn_nr"] = get_new_scipost_identifier( @@ -1612,15 +1614,13 @@ class SubmissionForm(forms.ModelForm): self.add_error("author_list", error_message) return author_list - def clean_collection(self): + def _clean_collection(self): """ Check that the collection is part of a series in the target journal and that 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", "") - if collection_id == "": - return collection_id collection = get_object_or_404(Collection, id=collection_id) # Check that the collection is part of a series in the target journal @@ -1655,7 +1655,6 @@ class SubmissionForm(forms.ModelForm): "None of the authors in the author list match any of the expected authors of this collection. " "Please check that the author list and collection are correct before contacting techsupport.", ) - return collection_id def clean_code_repository_url(self): """ -- GitLab