diff --git a/mayan/apps/sources/forms.py b/mayan/apps/sources/forms.py index 2263102e30..127d13be62 100644 --- a/mayan/apps/sources/forms.py +++ b/mayan/apps/sources/forms.py @@ -28,7 +28,7 @@ class StagingDocumentForm(DocumentForm): try: self.fields['staging_file_id'].choices = [ - (hash(staging_file), unicode(staging_file)) for staging_file in self.source.get_files() + (staging_file.encoded_filename, unicode(staging_file)) for staging_file in self.source.get_files() ] except Exception as exception: logger.error('exception: %s' % exception) diff --git a/mayan/apps/sources/views.py b/mayan/apps/sources/views.py index d7e00ad0bc..00d1032b1e 100644 --- a/mayan/apps/sources/views.py +++ b/mayan/apps/sources/views.py @@ -230,7 +230,7 @@ def upload_interactive(request, source_type=None, source_id=None, document_pk=No ) if form.is_valid(): try: - staging_file = StagingFile.get(form.cleaned_data['staging_file_id']) + staging_file = staging_folder.get_file(encoded_filename=form.cleaned_data['staging_file_id']) if document: expand = False else: @@ -245,7 +245,7 @@ def upload_interactive(request, source_type=None, source_id=None, document_pk=No new_filename = get_form_filename(form) result = staging_folder.upload_file( - staging_file.upload(), + staging_file.as_file(), new_filename, use_file_name=form.cleaned_data.get('use_file_name', False), document_type=document_type, expand=expand, @@ -267,8 +267,7 @@ def upload_interactive(request, source_type=None, source_id=None, document_pk=No messages.warning(request, _(u'Staging file: %s, was not compressed, uploaded as a single file.') % staging_file.filename) if staging_folder.delete_after_upload: - transformations, errors = staging_folder.get_transformation_list() - staging_file.delete(preview_size=staging_folder.get_preview_size(), transformations=transformations) + staging_file.delete() messages.success(request, _(u'Staging file: %s, deleted successfully.') % staging_file.filename) if document: return HttpResponseRedirect(reverse('document_view_simple', args=[document.pk]))