def render_row_actions(self, datum, pull_right=True, row=False):
"""Renders the actions specified in ``Meta.row_actions`` using the
current row data. If `row` is True, the actions are rendered in a row
of buttons. Otherwise they are rendered in a dropdown box.
"""
if row:
template_path = self._meta.row_actions_row_template
else:
template_path = self._meta.row_actions_dropdown_template
row_actions_template = template.loader.get_template(template_path)
bound_actions = self.get_row_actions(datum)
extra_context = {"row_actions": bound_actions,
"row_id": self.get_object_id(datum),
"pull_right": pull_right}
context = template.RequestContext(self.request, extra_context)
return row_actions_template.render(context)
评论列表
文章目录