Commit 14dec4f5 authored by Serge S. Koval's avatar Serge S. Koval

Fixed #840 - Do not resolve filter lazy strings early

parent 7199475a
......@@ -619,7 +619,7 @@ class BaseModelView(BaseView, ActionsMixin):
self._filter_groups[flt.name].append({
'index': i,
'arg': self.get_filter_arg(i, flt),
'operation': as_unicode(flt.operation()),
'operation': flt.operation(),
'options': flt.get_options(self) or None,
'type': flt.data_type
})
......@@ -854,6 +854,27 @@ class BaseModelView(BaseView, ActionsMixin):
else:
return str(index)
def _get_filter_groups(self):
"""
Returns non-lazy version of filter strings
"""
if self._filter_groups:
results = OrderedDict()
for key, value in iteritems(self._filter_groups):
items = []
for item in value:
copy = dict(item)
copy['operation'] = as_unicode(copy['operation'])
items.append(copy)
results[key] = items
return results
return None
# Form helpers
def scaffold_form(self):
"""
......@@ -1523,7 +1544,7 @@ class BaseModelView(BaseView, ActionsMixin):
# Filters
filters=self._filters,
filter_groups=self._filter_groups,
filter_groups=self._get_filter_groups(),
active_filters=view_args.filters,
# Actions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment