Improve single, multiple document and document versions downloads
By using a 2 step document download view
This commit is contained in:
@@ -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})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user