Initial staging file handling

This commit is contained in:
Roberto Rosario
2011-02-04 16:43:02 -04:00
parent 96219860d0
commit b3b704346f
6 changed files with 39 additions and 5 deletions

View File

@@ -59,7 +59,6 @@
{% endwith %}
{% endwith %}
{% endfor %}
{% endblock %}

View File

@@ -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 %}
<div class="content">
{% include subtemplate.name %}
</div>
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endfor %}
{% endblock %}

View File

@@ -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)

View File

@@ -1,3 +1,4 @@
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponseRedirect

View File

@@ -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))

View File

@@ -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