#718 - Allow filtering by multiple tags
This commit is contained in:
parent
1aa99bb405
commit
dc98fca853
2 changed files with 40 additions and 0 deletions
|
|
@ -252,6 +252,7 @@ def dhcp_configuration_from_querystring(querystring, option="DhcpConfiguration")
|
|||
|
||||
def filters_from_querystring(querystring_dict):
|
||||
response_values = {}
|
||||
last_tag_key = None
|
||||
for key, value in querystring_dict.items():
|
||||
match = re.search(r"Filter.(\d).Name", key)
|
||||
if match:
|
||||
|
|
@ -262,6 +263,10 @@ def filters_from_querystring(querystring_dict):
|
|||
for filter_key, filter_value in querystring_dict.items()
|
||||
if filter_key.startswith(value_prefix)
|
||||
]
|
||||
if value[0] == "tag-key":
|
||||
last_tag_key = "tag:" + filter_values[0]
|
||||
elif last_tag_key and value[0] == "tag-value":
|
||||
response_values[last_tag_key] = filter_values
|
||||
response_values[value[0]] = filter_values
|
||||
return response_values
|
||||
|
||||
|
|
@ -329,6 +334,8 @@ def tag_filter_matches(obj, filter_name, filter_values):
|
|||
tag_values = get_obj_tag_names(obj)
|
||||
elif filter_name == "tag-value":
|
||||
tag_values = get_obj_tag_values(obj)
|
||||
elif filter_name.startswith("tag:"):
|
||||
tag_values = get_obj_tag_values(obj)
|
||||
else:
|
||||
tag_values = [get_obj_tag(obj, filter_name) or ""]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue