Improve single, multiple document and document versions downloads

By using a 2 step document download view
This commit is contained in:
Roberto Rosario
2012-01-24 12:13:53 -04:00
parent 4eaf4bd785
commit e44ef229b0
2 changed files with 99 additions and 46 deletions

View File

@@ -312,3 +312,16 @@ class DocumentTypeFilenameForm_create(forms.ModelForm):
class Meta:
model = DocumentTypeFilename
fields = ('filename',)
class DocumentDownloadForm(forms.Form):
compressed = forms.BooleanField(label=_(u'Compress'), required=False, help_text=_(u'Download the document in the original format or in a compressed manner. This option is selectable only when downloading one document, for multiple documents, the bundle will always be downloads as a compressed file.'))
def __init__(self, *args, **kwargs):
self.document_versions = kwargs.pop('document_versions', None)
super(DocumentDownloadForm, self).__init__(*args, **kwargs)
if len(self.document_versions) > 1:
self.fields['compressed'].initial = True
self.fields['compressed'].widget.attrs.update({'disabled': True})