From f5bc3a89bb3032ac4ec4d487e8ab325177e1adc2 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Mon, 18 Mar 2024 11:04:25 +0100
Subject: [PATCH] remove subsidy attachment constraint

---
 scipost_django/finances/forms.py | 46 ++++++++++++++++----------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/scipost_django/finances/forms.py b/scipost_django/finances/forms.py
index 0dbc90b9d..3d13edcea 100644
--- a/scipost_django/finances/forms.py
+++ b/scipost_django/finances/forms.py
@@ -404,29 +404,29 @@ class SubsidyAttachmentForm(forms.ModelForm):
         required=False,
     )
 
-    def clean(self):
-        orphaned = self.cleaned_data["subsidy"] is None
-        attachment_filename = self.cleaned_data["attachment"].name.split("/")[-1]
-
-        # Allow misnamed orphans
-        if orphaned:
-            return
-
-        filename_regex = (
-            "^SciPost_"
-            "[0-9]{4,}(-[0-9]{4,})?_[A-Z]{2,}_[\w]+_"
-            "(Agreement|Invoice|ProofOfPayment|Other)"
-            "(-[0-9]{2,})?(_[\w]+)?\.(pdf|docx|png)$"
-        )
-        pattern = re.compile(filename_regex)
-
-        #
-        if not pattern.match(attachment_filename):
-            self.add_error(
-                "attachment",
-                "The filename does not match the required regex pattern "
-                f"'{filename_regex}'",
-            )
+    # def clean(self):
+    #     orphaned = self.cleaned_data["subsidy"] is None
+    #     attachment_filename = self.cleaned_data["attachment"].name.split("/")[-1]
+
+    #     # Allow misnamed orphans
+    #     if orphaned:
+    #         return
+
+    #     filename_regex = (
+    #         "^SciPost_"
+    #         "[0-9]{4,}(-[0-9]{4,})?_[A-Z]{2,}_[\w]+_"
+    #         "(Agreement|Invoice|ProofOfPayment|Other)"
+    #         "(-[0-9]{2,})?(_[\w]+)?\.(pdf|docx|png)$"
+    #     )
+    #     pattern = re.compile(filename_regex)
+
+    #     #
+    #     if not pattern.match(attachment_filename):
+    #         self.add_error(
+    #             "attachment",
+    #             "The filename does not match the required regex pattern "
+    #             f"'{filename_regex}'",
+    #         )
 
 
 #############
-- 
GitLab