Fix document download views. Fixes GL issue #229. Thanks to @ammaranjith for the find and fix idea.

This commit is contained in:
Roberto Rosario
2015-10-21 03:38:56 -04:00
parent 58f73f0b1e
commit f739dd54ac
3 changed files with 185 additions and 29 deletions

View File

@@ -137,9 +137,9 @@ class DocumentDownloadForm(forms.Form):
)
def __init__(self, *args, **kwargs):
self.document_versions = kwargs.pop('document_versions', None)
self.queryset = kwargs.pop('queryset', None)
super(DocumentDownloadForm, self).__init__(*args, **kwargs)
if len(self.document_versions) > 1:
if self.queryset.count() > 1:
self.fields['compressed'].initial = True
self.fields['compressed'].widget.attrs.update({'disabled': True})