fix: let caller request safe HTML literal for rendered grid table

mostly just for convenience
This commit is contained in:
Lance Edgar 2024-12-01 18:12:30 -06:00
parent f1c8ffedda
commit 2c269b640b

View file

@ -1223,6 +1223,7 @@ class Grid(WuttaGrid):
def render_table_element(self, template='/grids/b-table.mako',
data_prop='gridData', empty_labels=False,
literal=False,
**kwargs):
"""
This is intended for ad-hoc "small" grids with static data. Renders
@ -1239,7 +1240,10 @@ class Grid(WuttaGrid):
if context['paginated']:
context.setdefault('per_page', 20)
context['view_click_handler'] = self.get_view_click_handler()
return render(template, context)
result = render(template, context)
if literal:
result = HTML.literal(result)
return result
def get_view_click_handler(self):
""" """