Fix user and owner filters
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-08-06 07:09:16 +03:00
parent 5d9911e881
commit ebbe2669a6
2 changed files with 3 additions and 5 deletions

View File

@ -99,9 +99,7 @@ def build_query(base_query, fields=[], sort_fields={}):
q = base_query.copy() q = base_query.copy()
for attr, title, tp in fields: for attr, title, tp in fields:
key = attr.replace(".", "_") key = attr.replace(".", "_")
if key in ("inventory_owner_username", "inventory_user_username"): if tp == list:
val = request.args.get(key, type=dict)
elif tp == list:
val = request.args.getlist(key) val = request.args.getlist(key)
val = list(map(str, val)) val = list(map(str, val))
else: else:

View File

@ -355,8 +355,8 @@ def view_inventory(slug=None):
template = "inventory_public.html" template = "inventory_public.html"
public_view = True public_view = True
else: else:
fields.append(("inventory.owner.username", "Owner", list)) fields.append(("inventory.owner.username", "Owner", str))
fields.append(("inventory.user.username", "User", list)) fields.append(("inventory.user.username", "User", str))
if slug and not public_view: if slug and not public_view:
template = "inventory_pick.html" template = "inventory_pick.html"
if request.path.startswith("/m/inventory/clone-with-slug"): if request.path.startswith("/m/inventory/clone-with-slug"):