Return the corresponing keyword arguments to the view of the document
thumbnail widget depending on the view type: template or API.
This commit is contained in:
@@ -101,11 +101,21 @@ class InstanceImageWidget(object):
|
||||
|
||||
# Click view
|
||||
def get_click_view_kwargs(self, instance):
|
||||
return {
|
||||
'pk': instance.document.pk,
|
||||
'version_pk': instance.document_version.pk,
|
||||
'page_pk': instance.pk
|
||||
}
|
||||
"""
|
||||
Determine if the view is a template or API view and vary the view
|
||||
keyword arguments
|
||||
"""
|
||||
|
||||
if self.click_view_name.startswith('rest_api'):
|
||||
return {
|
||||
'pk': instance.document.pk,
|
||||
'version_pk': instance.document_version.pk,
|
||||
'page_pk': instance.pk
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'pk': instance.pk,
|
||||
}
|
||||
|
||||
def get_click_view_query_dict(self, instance):
|
||||
return self.click_view_query_dict
|
||||
|
||||
Reference in New Issue
Block a user