def render(self):
"""Renders the tab to HTML using the
:meth:`~horizon.tabs.Tab.get_context_data` method and
the :meth:`~horizon.tabs.Tab.get_template_name` method.
If :attr:`~horizon.tabs.Tab.preload` is ``False`` and ``force_load``
is not ``True``, or
either :meth:`~horizon.tabs.Tab.allowed` or
:meth:`~horizon.tabs.Tab.enabled` returns ``False`` this method will
return an empty string.
"""
if not self.load:
return ''
try:
context = self.data
except exceptions.Http302:
raise
except Exception:
exc_type, exc_value, exc_traceback = sys.exc_info()
raise six.reraise(TemplateSyntaxError, exc_value, exc_traceback)
return render_to_string(self.get_template_name(self.request), context)
评论列表
文章目录