Fix document preview view.
This commit is contained in:
@@ -47,7 +47,7 @@ class DocumentPageForm(DetailForm):
|
|||||||
|
|
||||||
class DocumentPreviewForm(forms.Form):
|
class DocumentPreviewForm(forms.Form):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
document = kwargs.pop('document', None)
|
document = kwargs.pop('instance', None)
|
||||||
super(DocumentPreviewForm, self).__init__(*args, **kwargs)
|
super(DocumentPreviewForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['preview'].initial = document
|
self.fields['preview'].initial = document
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ class DocumentPageView(SimpleView):
|
|||||||
|
|
||||||
|
|
||||||
class DocumentPreviewView(SingleObjectDetailView):
|
class DocumentPreviewView(SingleObjectDetailView):
|
||||||
|
form_class = DocumentPreviewForm
|
||||||
model = Document
|
model = Document
|
||||||
object_permission = permission_document_view
|
object_permission = permission_document_view
|
||||||
|
|
||||||
@@ -301,7 +302,6 @@ class DocumentPreviewView(SingleObjectDetailView):
|
|||||||
|
|
||||||
def get_extra_context(self):
|
def get_extra_context(self):
|
||||||
return {
|
return {
|
||||||
'form': DocumentPreviewForm(document=self.get_object()),
|
|
||||||
'hide_labels': True,
|
'hide_labels': True,
|
||||||
'object': self.get_object(),
|
'object': self.get_object(),
|
||||||
'title': _('Preview of document: %s') % self.get_object(),
|
'title': _('Preview of document: %s') % self.get_object(),
|
||||||
|
|||||||
Reference in New Issue
Block a user