diff --git a/mayan/apps/documents/forms.py b/mayan/apps/documents/forms.py index a874daa6fb..d1c6126f94 100644 --- a/mayan/apps/documents/forms.py +++ b/mayan/apps/documents/forms.py @@ -47,7 +47,7 @@ class DocumentPageForm(DetailForm): class DocumentPreviewForm(forms.Form): def __init__(self, *args, **kwargs): - document = kwargs.pop('document', None) + document = kwargs.pop('instance', None) super(DocumentPreviewForm, self).__init__(*args, **kwargs) self.fields['preview'].initial = document try: diff --git a/mayan/apps/documents/views.py b/mayan/apps/documents/views.py index 5b58c10f41..f72dc3f28f 100644 --- a/mayan/apps/documents/views.py +++ b/mayan/apps/documents/views.py @@ -289,6 +289,7 @@ class DocumentPageView(SimpleView): class DocumentPreviewView(SingleObjectDetailView): + form_class = DocumentPreviewForm model = Document object_permission = permission_document_view @@ -301,7 +302,6 @@ class DocumentPreviewView(SingleObjectDetailView): def get_extra_context(self): return { - 'form': DocumentPreviewForm(document=self.get_object()), 'hide_labels': True, 'object': self.get_object(), 'title': _('Preview of document: %s') % self.get_object(),