fix: misc. bugfixes per recent changes
This commit is contained in:
parent
f292850d05
commit
7b40c527c8
|
@ -260,6 +260,9 @@ class Grid(WuttaGrid):
|
||||||
# reference grid.vue_component etc.
|
# reference grid.vue_component etc.
|
||||||
kwargs.setdefault('vue_tagname', 'tailbone-grid')
|
kwargs.setdefault('vue_tagname', 'tailbone-grid')
|
||||||
|
|
||||||
|
# nb. these must be set before super init, as they are
|
||||||
|
# referenced when constructing filters
|
||||||
|
self.assume_local_times = assume_local_times
|
||||||
self.use_byte_string_filters = use_byte_string_filters
|
self.use_byte_string_filters = use_byte_string_filters
|
||||||
|
|
||||||
kwargs['key'] = key
|
kwargs['key'] = key
|
||||||
|
@ -279,7 +282,6 @@ class Grid(WuttaGrid):
|
||||||
|
|
||||||
self.width = width
|
self.width = width
|
||||||
self.enums = enums or {}
|
self.enums = enums or {}
|
||||||
self.assume_local_times = assume_local_times
|
|
||||||
self.renderers = self.make_default_renderers(self.renderers)
|
self.renderers = self.make_default_renderers(self.renderers)
|
||||||
self.raw_renderers = raw_renderers or {}
|
self.raw_renderers = raw_renderers or {}
|
||||||
self.invisible = invisible or []
|
self.invisible = invisible or []
|
||||||
|
@ -476,25 +478,18 @@ class Grid(WuttaGrid):
|
||||||
|
|
||||||
def set_filter(self, key, *args, **kwargs):
|
def set_filter(self, key, *args, **kwargs):
|
||||||
""" """
|
""" """
|
||||||
|
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
if args[0] is None:
|
if args[0] is None:
|
||||||
warnings.warn("specifying None is deprecated for Grid.set_filter(); "
|
warnings.warn("specifying None is deprecated for Grid.set_filter(); "
|
||||||
"please use Grid.remove_filter() instead",
|
"please use Grid.remove_filter() instead",
|
||||||
DeprecationWarning, stacklevel=2)
|
DeprecationWarning, stacklevel=2)
|
||||||
self.remove_filter(key)
|
self.remove_filter(key)
|
||||||
else:
|
return
|
||||||
super().set_filter(key, args[0], **kwargs)
|
|
||||||
|
|
||||||
elif len(args) == 0:
|
# TODO: our make_filter() signature differs from upstream,
|
||||||
super().set_filter(key, **kwargs)
|
# so must call it explicitly instead of delegating to super
|
||||||
|
kwargs.setdefault('label', self.get_label(key))
|
||||||
else:
|
self.filters[key] = self.make_filter(key, *args, **kwargs)
|
||||||
warnings.warn("multiple args are deprecated for Grid.set_filter(); "
|
|
||||||
"please refactor your code accordingly",
|
|
||||||
DeprecationWarning, stacklevel=2)
|
|
||||||
kwargs.setdefault('label', self.get_label(key))
|
|
||||||
self.filters[key] = self.make_filter(key, *args, **kwargs)
|
|
||||||
|
|
||||||
def set_click_handler(self, key, handler):
|
def set_click_handler(self, key, handler):
|
||||||
if handler:
|
if handler:
|
||||||
|
@ -1230,7 +1225,7 @@ class Grid(WuttaGrid):
|
||||||
context['data_prop'] = data_prop
|
context['data_prop'] = data_prop
|
||||||
context['empty_labels'] = empty_labels
|
context['empty_labels'] = empty_labels
|
||||||
if 'grid_columns' not in context:
|
if 'grid_columns' not in context:
|
||||||
context['grid_columns'] = self.get_table_columns()
|
context['grid_columns'] = self.get_vue_columns()
|
||||||
context.setdefault('paginated', False)
|
context.setdefault('paginated', False)
|
||||||
if context['paginated']:
|
if context['paginated']:
|
||||||
context.setdefault('per_page', 20)
|
context.setdefault('per_page', 20)
|
||||||
|
|
|
@ -116,11 +116,12 @@ class EmailSettingView(MasterView):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def configure_grid(self, g):
|
def configure_grid(self, g):
|
||||||
g.sorters['key'] = g.make_simple_sorter('key', foldcase=True)
|
super().configure_grid(g)
|
||||||
g.sorters['prefix'] = g.make_simple_sorter('prefix', foldcase=True)
|
|
||||||
g.sorters['subject'] = g.make_simple_sorter('subject', foldcase=True)
|
g.sort_on_backend = False
|
||||||
g.sorters['enabled'] = g.make_simple_sorter('enabled')
|
g.sort_multiple = False
|
||||||
g.set_sort_defaults('key')
|
g.set_sort_defaults('key')
|
||||||
|
|
||||||
g.set_type('enabled', 'boolean')
|
g.set_type('enabled', 'boolean')
|
||||||
g.set_link('key')
|
g.set_link('key')
|
||||||
g.set_link('subject')
|
g.set_link('subject')
|
||||||
|
@ -130,11 +131,9 @@ class EmailSettingView(MasterView):
|
||||||
|
|
||||||
# to
|
# to
|
||||||
g.set_renderer('to', self.render_to_short)
|
g.set_renderer('to', self.render_to_short)
|
||||||
g.sorters['to'] = g.make_simple_sorter('to', foldcase=True)
|
|
||||||
|
|
||||||
# hidden
|
# hidden
|
||||||
if self.has_perm('configure'):
|
if self.has_perm('configure'):
|
||||||
g.sorters['hidden'] = g.make_simple_sorter('hidden')
|
|
||||||
g.set_type('hidden', 'boolean')
|
g.set_type('hidden', 'boolean')
|
||||||
else:
|
else:
|
||||||
g.remove('hidden')
|
g.remove('hidden')
|
||||||
|
|
Loading…
Reference in a new issue