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:
Roberto Rosario
2017-02-16 21:46:40 -04:00
parent 80f64d7fcf
commit cd32c5bda5

View File

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