diff --git a/apps/common/templates/generic_detail.html b/apps/common/templates/generic_detail.html index b52e1d903a..b1b7107d10 100755 --- a/apps/common/templates/generic_detail.html +++ b/apps/common/templates/generic_detail.html @@ -59,7 +59,6 @@ {% endwith %} {% endwith %} {% endfor %} - {% endblock %} diff --git a/apps/common/templates/generic_form.html b/apps/common/templates/generic_form.html index 755174435b..ba1a2955dc 100755 --- a/apps/common/templates/generic_form.html +++ b/apps/common/templates/generic_form.html @@ -3,4 +3,23 @@ {% block content %} {% include "generic_form_subtemplate.html" %} + + {% for subtemplate in subtemplates_dict %} + {% with subtemplate.title as title %} + {% with subtemplate.object_list as object_list %} + {% with subtemplate.extra_columns as extra_columns %} + {% with subtemplate.hide_object as hide_object %} + {% with subtemplate.main_object as main_object %} + {% with subtemplate.hide_link as hide_link %} +
+ {% include subtemplate.name %} +
+ {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endfor %} + {% endblock %} diff --git a/apps/documents/conf/settings.py b/apps/documents/conf/settings.py index 6554e02f4d..bb6a8df8cd 100644 --- a/apps/documents/conf/settings.py +++ b/apps/documents/conf/settings.py @@ -13,3 +13,4 @@ FILESERVING_PATH = getattr(settings, 'DOCUMENTS_FILESERVING_PATH', u'/tmp') DELETE_ORIGINAL = getattr(settings, 'DOCUMENTS_DELETE_ORIGINAL', False) SLUGIFY_PATH = getattr(settings, 'DOCUMENTS_SLUGIFY_PATH', False) CHECKSUM_FUNCTION = getattr(settings, 'DOCUMENTS_CHECKSUM_FUNCTION', lambda x: hashlib.sha256(x).hexdigest()) +DELETE_STAGING_FILE_AFTER_UPLOAD = getattr(settings, 'DOCUMENTS_DELETE_STAGING_FILE_AFTER_UPLOAD', False) diff --git a/apps/documents/forms.py b/apps/documents/forms.py index 1c22dfe4f2..c962e4c9da 100644 --- a/apps/documents/forms.py +++ b/apps/documents/forms.py @@ -1,3 +1,4 @@ + from django import forms from django.utils.translation import ugettext_lazy as _ from django.http import HttpResponseRedirect diff --git a/apps/documents/views.py b/apps/documents/views.py index ef7c7bf060..b448ea87f8 100644 --- a/apps/documents/views.py +++ b/apps/documents/views.py @@ -1,4 +1,5 @@ import datetime +import os from django.utils.translation import ugettext as _ from django.http import HttpResponse, HttpResponseRedirect @@ -16,7 +17,8 @@ from forms import DocumentForm_view from models import Document, DocumentMetadata, DocumentType, MetadataType from forms import DocumentTypeSelectForm, DocumentCreateWizard, \ MetadataForm, DocumentForm - + +from documents.conf.settings import STAGING_DIRECTORY def document_list(request): return object_list( @@ -71,9 +73,20 @@ def upload_document_with_type(request, document_type_id, multiple=True): return HttpResponseRedirect(reverse('document_list')) else: form = DocumentForm(initial={'document_type':document_type}) + + filelist = sorted([os.path.normcase(f) for f in os.listdir(STAGING_DIRECTORY)]) return render_to_response('generic_form.html', { - 'form':form + 'form':form, + 'subtemplates_dict':[ + { + 'name':'generic_list_subtemplate.html', + 'title':_(u'files in staging'), + 'object_list':filelist, + #'extra_columns':[{'name':_(u'qty'), 'attribute':'qty'}], + }, + ], + }, context_instance=RequestContext(request)) diff --git a/docs/TODO b/docs/TODO index 4a1544e9ef..2eacc1e249 100644 --- a/docs/TODO +++ b/docs/TODO @@ -3,7 +3,7 @@ * Create indexing filesystem folders from document type metadata type - DONE * Document detail to view document metadata - DONE * Add file checksums (hashlib) - DONE -* Filter by metadata +* Document list filtering by metadata * Jquery upload document upload form with ajax widget * Filterform date filtering widget * Validate GET data before saving file @@ -12,4 +12,5 @@ * Delete symlinks when document is deleted of metadata changed * Check duplicated files using checksum * If theres only one document type on db skip step 1 of wizard - +* Option to delete source staging file after upload +* Show last 5 recent metadata setups for easy switch