Refactor batch view/edit pages to share some "execution options" logic

This commit is contained in:
Lance Edgar 2016-08-22 15:46:16 -05:00
parent 53950931af
commit cdde848275
4 changed files with 67 additions and 43 deletions

View file

@ -331,7 +331,7 @@ class BatchMasterView(MasterView):
self.get_model_title(), self.get_instance_title(batch)))
return self.redirect_after_edit(batch)
return self.render_to_response('edit', {
context = {
'instance': batch,
'instance_title': self.get_instance_title(batch),
'instance_deletable': self.deletable_instance(batch),
@ -340,7 +340,12 @@ class BatchMasterView(MasterView):
'rows_grid': grid,
'execute_title': self.get_execute_title(batch),
'execute_enabled': self.executable(batch),
})
}
if context['execute_enabled'] and self.has_execution_options:
context['rendered_execution_options'] = self.render_execution_options()
return self.render_to_response('edit', context)
def redirect_after_edit(self, batch):
"""