Commit 41a68dde authored by Bryan Hoyt's avatar Bryan Hoyt

Revert "Parse optional named filters from filter url"

This reverts commit c424c3fe.
parent 08d09c31
......@@ -958,34 +958,27 @@ class BaseModelView(BaseView, ActionsMixin):
sort_desc = request.args.get('desc', None, type=int)
search = request.args.get('search', None)
filter_idx_by_label = dict((flt.query_label(), i) for i, flt in enumerate(self._filters))
# Gather filters
if self._filters:
sfilters = []
for n in request.args:
if not n.startswith('flt'):
if n.startswith('flt'):
ofs = n.find('_')
if ofs == -1:
continue
pos, filter_label = n[3:].split('_', 1)
# If pos not specified, just add incrementally to the list.
pos = int(pos) if pos else len(sfilters)
try:
# See if filter is numeric
idx = int(filter_label)
pos = int(n[3:ofs])
idx = int(n[ofs + 1:])
except ValueError:
# If non-numeric, look filter up by name
try:
idx = filter_idx_by_label[filter_label]
except KeyError:
# No matching filter name
continue
if 0 <= idx < len(self._filters):
if idx >= 0 and idx < len(self._filters):
flt = self._filters[idx]
value = request.args[n]
if flt.validate(value):
sfilters.append((pos, (idx, flt.clean(value))))
......
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