From 59251a4986edd8c03a8699dc0c49fa1ce9b8ba46 Mon Sep 17 00:00:00 2001
From: sandeepsajan0 <sandeepsajan0@gmail.com>
Date: Wed, 12 Oct 2022 17:37:43 +0530
Subject: [PATCH] Rename upload button to submit and remove title/filename
 field from upload document form

---
 hypha/apply/projects/forms/project.py                  | 10 +++++-----
 .../includes/supporting_documents.html                 |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hypha/apply/projects/forms/project.py b/hypha/apply/projects/forms/project.py
index f503671a1..bee6ff8b2 100644
--- a/hypha/apply/projects/forms/project.py
+++ b/hypha/apply/projects/forms/project.py
@@ -172,16 +172,16 @@ class UploadDocumentForm(FileFormMixin, forms.ModelForm):
     document = SingleFileField(label=_('Document'), required=True)
 
     class Meta:
-        fields = ['title', 'category', 'document']
+        fields = ['category', 'document']
         model = PacketFile
-        widgets = {'title': forms.TextInput()}
-        labels = {
-            "title": _('File Name'),
-        }
 
     def __init__(self, user=None, instance=None, *args, **kwargs):
         super().__init__(*args, **kwargs)
 
+    def save(self, commit=True):
+        self.instance.title = self.instance.document
+        return super(UploadDocumentForm, self).save(commit=True)
+
 
 class UpdateProjectLeadForm(forms.ModelForm):
     class Meta:
diff --git a/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html b/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html
index e8f99c9a1..8b65f8b5b 100644
--- a/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html
+++ b/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html
@@ -156,6 +156,6 @@
 <div class="modal" id="upload-supporting-doc">
     <h4 class="modal__header-bar">{% trans "Upload a new document" %}</h4>
     <p></p>
-    {% trans "Upload" as upload %}
-    {% include 'funds/includes/delegated_form_base.html' with form=document_form value=upload %}
+    {% trans "Submit" as submit %}
+    {% include 'funds/includes/delegated_form_base.html' with form=document_form value=submit %}
 </div>
-- 
GitLab