Allow passing arbitrary attrs when rendering grid

This commit is contained in:
Lance Edgar 2018-02-09 21:13:41 -06:00
parent e2bfb31cb2
commit 91b395118e
2 changed files with 2 additions and 1 deletions

View file

@ -375,6 +375,7 @@ class Grid(object):
elif self.width == 'half': elif self.width == 'half':
grid_class = 'half' grid_class = 'half'
context['grid_class'] = '{} {}'.format(grid_class, context.get('grid_class', '')) context['grid_class'] = '{} {}'.format(grid_class, context.get('grid_class', ''))
context.setdefault('grid_attrs', {})
return render(template, context) return render(template, context)
def get_default_filters(self): def get_default_filters(self):

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8; -*- ## -*- coding: utf-8; -*-
<div class="grid ${grid_class}"> <div class="grid ${grid_class}" ${h.HTML.render_attrs(grid_attrs)}>
<table> <table>
${grid.make_webhelpers_grid()} ${grid.make_webhelpers_grid()}
</table> </table>