Fix document preview view.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user