diff --git a/mayan/apps/documents/api_views.py b/mayan/apps/documents/api_views.py index 0a455d6417..e86e54be10 100644 --- a/mayan/apps/documents/api_views.py +++ b/mayan/apps/documents/api_views.py @@ -238,7 +238,8 @@ class APIDocumentPageImageView(generics.RetrieveAPIView): response = HttpResponse(file_object.read(), content_type='image') if '_hash' in request.GET: patch_cache_control( - response, max_age=settings_document_page_image_cache_time.value + response, + max_age=settings_document_page_image_cache_time.value ) return response diff --git a/mayan/apps/documents/forms.py b/mayan/apps/documents/forms.py index 0e1254dd84..58625d8553 100644 --- a/mayan/apps/documents/forms.py +++ b/mayan/apps/documents/forms.py @@ -26,6 +26,8 @@ logger = logging.getLogger(__name__) class DocumentPageForm(forms.Form): + document_page = DocumentPageField() + def __init__(self, *args, **kwargs): instance = kwargs.pop('instance', None) rotation = kwargs.pop('rotation', None) @@ -37,27 +39,25 @@ class DocumentPageForm(forms.Form): 'rotation': rotation, }) - document_page = DocumentPageField() - # Document forms class DocumentPreviewForm(forms.Form): + document = DocumentField() + def __init__(self, *args, **kwargs): document = kwargs.pop('instance', None) super(DocumentPreviewForm, self).__init__(*args, **kwargs) self.fields['document'].initial = document - document = DocumentField() - class DocumentVersionPreviewForm(forms.Form): + document_version = DocumentVersionField() + def __init__(self, *args, **kwargs): document_version = kwargs.pop('instance', None) super(DocumentVersionPreviewForm, self).__init__(*args, **kwargs) self.fields['document_version'].initial = document_version - document_version = DocumentVersionField() - class DocumentForm(forms.ModelForm): """