From 35b6ce52853293c4706a1f29779fbab8f6062a72 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 8 Jul 2015 01:00:32 -0400 Subject: [PATCH] Don't set the default document label in the view, do it at the task level which is accesible always. --- mayan/apps/sources/tasks.py | 3 +++ mayan/apps/sources/views.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mayan/apps/sources/tasks.py b/mayan/apps/sources/tasks.py index b0124dde39..75d65acf60 100644 --- a/mayan/apps/sources/tasks.py +++ b/mayan/apps/sources/tasks.py @@ -38,6 +38,9 @@ def task_source_upload_document(label, document_type_id, shared_uploaded_file_id else: user = None + if not label: + label = shared_uploaded_file.filename + with shared_uploaded_file.open() as file_object: source.upload_document(description=description, document_type=document_type, expand=expand, file_object=file_object, label=label, language=language, metadata_dict_list=metadata_dict_list, user=user) diff --git a/mayan/apps/sources/views.py b/mayan/apps/sources/views.py index 66906c08bc..fbbed79910 100644 --- a/mayan/apps/sources/views.py +++ b/mayan/apps/sources/views.py @@ -215,10 +215,11 @@ class UploadInteractiveView(UploadBaseView): shared_uploaded_file = SharedUploadedFile.objects.create(file=uploaded_file.file) - label = shared_uploaded_file.filename if 'document_type_available_filenames' in forms['document_form'].cleaned_data: if forms['document_form'].cleaned_data['document_type_available_filenames']: label = forms['document_form'].cleaned_data['document_type_available_filenames'].filename + else: + label = None if not self.request.user.is_anonymous(): user_id = self.request.user.pk