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.
|
||||
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
|
||||
|
||||
kwargs['key'] = key
|
||||
|
@ -279,7 +282,6 @@ class Grid(WuttaGrid):
|
|||
|
||||
self.width = width
|
||||
self.enums = enums or {}
|
||||
self.assume_local_times = assume_local_times
|
||||
self.renderers = self.make_default_renderers(self.renderers)
|
||||
self.raw_renderers = raw_renderers or {}
|
||||
self.invisible = invisible or []
|
||||
|
@ -476,25 +478,18 @@ class Grid(WuttaGrid):
|
|||
|
||||
def set_filter(self, key, *args, **kwargs):
|
||||
""" """
|
||||
|
||||
if len(args) == 1:
|
||||
if args[0] is None:
|
||||
warnings.warn("specifying None is deprecated for Grid.set_filter(); "
|
||||
"please use Grid.remove_filter() instead",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
self.remove_filter(key)
|
||||
else:
|
||||
super().set_filter(key, args[0], **kwargs)
|
||||
return
|
||||
|
||||
elif len(args) == 0:
|
||||
super().set_filter(key, **kwargs)
|
||||
|
||||
else:
|
||||
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)
|
||||
# TODO: our make_filter() signature differs from upstream,
|
||||
# so must call it explicitly instead of delegating to super
|
||||
kwargs.setdefault('label', self.get_label(key))
|
||||
self.filters[key] = self.make_filter(key, *args, **kwargs)
|
||||
|
||||
def set_click_handler(self, key, handler):
|
||||
if handler:
|
||||
|
@ -1230,7 +1225,7 @@ class Grid(WuttaGrid):
|
|||
context['data_prop'] = data_prop
|
||||
context['empty_labels'] = empty_labels
|
||||
if 'grid_columns' not in context:
|
||||
context['grid_columns'] = self.get_table_columns()
|
||||
context['grid_columns'] = self.get_vue_columns()
|
||||
context.setdefault('paginated', False)
|
||||
if context['paginated']:
|
||||
context.setdefault('per_page', 20)
|
||||
|
|
|
@ -116,11 +116,12 @@ class EmailSettingView(MasterView):
|
|||
return data
|
||||
|
||||
def configure_grid(self, g):
|
||||
g.sorters['key'] = g.make_simple_sorter('key', foldcase=True)
|
||||
g.sorters['prefix'] = g.make_simple_sorter('prefix', foldcase=True)
|
||||
g.sorters['subject'] = g.make_simple_sorter('subject', foldcase=True)
|
||||
g.sorters['enabled'] = g.make_simple_sorter('enabled')
|
||||
super().configure_grid(g)
|
||||
|
||||
g.sort_on_backend = False
|
||||
g.sort_multiple = False
|
||||
g.set_sort_defaults('key')
|
||||
|
||||
g.set_type('enabled', 'boolean')
|
||||
g.set_link('key')
|
||||
g.set_link('subject')
|
||||
|
@ -130,11 +131,9 @@ class EmailSettingView(MasterView):
|
|||
|
||||
# to
|
||||
g.set_renderer('to', self.render_to_short)
|
||||
g.sorters['to'] = g.make_simple_sorter('to', foldcase=True)
|
||||
|
||||
# hidden
|
||||
if self.has_perm('configure'):
|
||||
g.sorters['hidden'] = g.make_simple_sorter('hidden')
|
||||
g.set_type('hidden', 'boolean')
|
||||
else:
|
||||
g.remove('hidden')
|
||||
|
|
Loading…
Reference in a new issue