Rename grids/complete template (avoid buefy name)

and rename grid methods accordingly
This commit is contained in:
Lance Edgar 2024-04-13 10:02:57 -05:00
parent 1103b09a76
commit 96ba039299
6 changed files with 27 additions and 17 deletions

View file

@ -5,6 +5,17 @@ CHANGELOG
Unreleased Unreleased
---------- ----------
* Avoid uncaught error when updating order batch row quantities.
* Try to return JSON error when receiving API call fails.
* Avoid error for tax field when creating new department.
* Show toast msg instead of silent error, when grid fetch fails.
* Rename template files to avoid "buefy" names.
0.9.90 (2024-04-01) 0.9.90 (2024-04-01)
------------------- -------------------

View file

@ -1333,18 +1333,7 @@ class Grid(object):
data = self.pager data = self.pager
return data return data
def render_complete(self, template='/grids/buefy.mako', **kwargs): def render_complete(self, template='/grids/complete.mako', **kwargs):
"""
Render the complete grid, including filters.
"""
context = kwargs
context['grid'] = self
context['request'] = self.request
context.setdefault('allow_save_defaults', True)
context.setdefault('view_click_handler', self.get_view_click_handler())
return render(template, context)
def render_buefy(self, template='/grids/buefy.mako', **kwargs):
""" """
Render the Buefy grid, complete with filters. Note that this also Render the Buefy grid, complete with filters. Note that this also
includes the context menu items and grid tools. includes the context menu items and grid tools.
@ -1364,7 +1353,17 @@ class Grid(object):
if self.filterable and 'filters_sequence' not in kwargs: if self.filterable and 'filters_sequence' not in kwargs:
kwargs['filters_sequence'] = self.get_filters_sequence() kwargs['filters_sequence'] = self.get_filters_sequence()
return self.render_complete(template=template, **kwargs) context = kwargs
context['grid'] = self
context['request'] = self.request
context.setdefault('allow_save_defaults', True)
context.setdefault('view_click_handler', self.get_view_click_handler())
return render(template, context)
def render_buefy(self, **kwargs):
warnings.warn("Grid.render_buefy() is deprecated; "
"please use Grid.render_complete() instead",
DeprecationWarning, stacklevel=2)
def render_buefy_table_element(self, template='/grids/b-table.mako', def render_buefy_table_element(self, template='/grids/b-table.mako',
data_prop='gridData', empty_labels=False, data_prop='gridData', empty_labels=False,

View file

@ -327,7 +327,7 @@
${parent.render_this_page_template()} ${parent.render_this_page_template()}
## TODO: stop using |n filter ## TODO: stop using |n filter
${grid.render_buefy(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n} ${grid.render_complete(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n}
</%def> </%def>
<%def name="modify_this_page_vars()"> <%def name="modify_this_page_vars()">

View file

@ -31,7 +31,7 @@
${parent.render_this_page_template()} ${parent.render_this_page_template()}
## TODO: stop using |n filter ## TODO: stop using |n filter
${grid.render_buefy()|n} ${grid.render_complete()|n}
</%def> </%def>
<%def name="page_content()"> <%def name="page_content()">

View file

@ -228,11 +228,11 @@
<%def name="render_this_page_template()"> <%def name="render_this_page_template()">
% if master.has_rows: % if master.has_rows:
## TODO: stop using |n filter ## TODO: stop using |n filter
${rows_grid.render_buefy(allow_save_defaults=False, tools=capture(self.render_row_grid_tools))|n} ${rows_grid.render_complete(allow_save_defaults=False, tools=capture(self.render_row_grid_tools))|n}
% endif % endif
${parent.render_this_page_template()} ${parent.render_this_page_template()}
% if expose_versions: % if expose_versions:
${versions_grid.render_buefy()|n} ${versions_grid.render_complete()|n}
% endif % endif
</%def> </%def>