Documents: PEP8 and code style cleanups

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-11-29 02:11:26 -04:00
parent e0d900d952
commit 52bbf62e26
2 changed files with 8 additions and 7 deletions

View File

@@ -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

View File

@@ -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):
"""