Simplify workflow instance detail view
This commit is contained in:
@@ -60,8 +60,6 @@ class DocumentWorkflowInstanceListView(SingleObjectListView):
|
||||
|
||||
|
||||
class WorkflowInstanceDetailView(SingleObjectListView):
|
||||
template_name = 'appearance/generic_multi_subtemplates.html'
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
try:
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_DOCUMENT_WORKFLOW_VIEW])
|
||||
@@ -77,33 +75,12 @@ class WorkflowInstanceDetailView(SingleObjectListView):
|
||||
return self.get_workflow_instance().log_entries.order_by('-datetime')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
form = WorkflowInstanceDetailForm(
|
||||
instance=self.get_workflow_instance(), extra_fields=[
|
||||
{'label': _('Current state'), 'field': 'get_current_state'},
|
||||
{'label': _('Last transition'), 'field': 'get_last_transition'},
|
||||
]
|
||||
)
|
||||
|
||||
context = {
|
||||
'navigation_object_list': ['object', 'workflow_instance'],
|
||||
'object': self.get_workflow_instance().document,
|
||||
'subtemplates_list': [
|
||||
{
|
||||
'name': 'appearance/generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': form,
|
||||
'read_only': True,
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'appearance/generic_list_subtemplate.html',
|
||||
'context': {
|
||||
'object_list': self.get_queryset(),
|
||||
'title': _('Log entries'),
|
||||
'hide_object': True,
|
||||
}
|
||||
}
|
||||
],
|
||||
'object_list': self.get_queryset(),
|
||||
'title': _('Log entries'),
|
||||
'hide_object': True,
|
||||
'title': _('Detail of workflow: %(workflow)s') % {
|
||||
'workflow': self.get_workflow_instance()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user