router_list.html: Add filter for V1/V2/Local

Usage: network:<local|v2|v1>

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2018-09-21 13:47:01 +02:00
parent f99f05fb71
commit 0f82f43385
1 changed files with 11 additions and 0 deletions

View File

@ -31,6 +31,7 @@ allowed_filters = (
'selected',
'bat',
'batselected',
'network',
)
def parse_router_list_search_query(args):
@ -112,6 +113,16 @@ def parse_router_list_search_query(args):
elif key == 'contact':
k = "contact {} REGEXP %s".format(no)
t.append(value)
elif key == 'network':
# local hood included for v2
if value.lower() == 'local':
k = no + " (router.v2 = TRUE AND local = TRUE)"
elif value.lower() == 'v2':
k = no + " (router.v2 = TRUE AND local = FALSE)"
elif value.lower() == 'v1':
k = no + " router.v2 = FALSE"
else:
continue
else:
k = no + key + " = %s"
t.append(value)