Added means to expand or not a compressed file during document creation, removed configuration options UNCOMPRESS_COMPRESSED_LOCAL_FILES and UNCOMPRESS_COMPRESSED_STAGING_FILES

This commit is contained in:
Roberto Rosario
2011-06-28 00:08:22 -04:00
parent ec73dd1874
commit 327b677444
3 changed files with 22 additions and 8 deletions

View File

@@ -186,10 +186,20 @@ class DocumentForm(forms.ModelForm):
queryset=filenames_qs,
required=False,
label=_(u'Quick document rename'))
# Put the expand field last in the field order list
expand_field_index = self.fields.keyOrder.index('expand')
expand_field = self.fields.keyOrder.pop(expand_field_index)
self.fields.keyOrder.append(expand_field)
new_filename = forms.CharField(
label=_('New document filename'), required=False
)
expand = forms.BooleanField(
label=_(u'Expand compressed files'), required=False,
help_text=ugettext(u'Upload a compressed file\'s contained files as individual documents')
)
class DocumentForm_edit(DocumentForm):
@@ -198,8 +208,13 @@ class DocumentForm_edit(DocumentForm):
"""
class Meta:
model = Document
exclude = ('file', 'document_type', 'tags')
exclude = ('file', 'document_type', 'tags', 'expand')
def __init__(self, *args, **kwargs):
super(DocumentForm_edit, self).__init__(*args, **kwargs)
self.fields.pop('expand')
class DocumentPropertiesForm(DetailForm):
"""
@@ -267,7 +282,8 @@ class StagingDocumentForm(DocumentForm):
pass
# Put staging_list field first in the field order list
staging_list = self.fields.keyOrder.pop(1)
staging_list_index = self.fields.keyOrder.index('staging_file_id')
staging_list = self.fields.keyOrder.pop(staging_list_index)
self.fields.keyOrder.insert(0, staging_list)
staging_file_id = forms.ChoiceField(label=_(u'Staging file'))