1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add support for referencing peer field values in query_params

This commit is contained in:
Jeremy Stretch
2020-08-12 12:36:53 -04:00
parent d752c36ea8
commit 100c8fef20
7 changed files with 340 additions and 478 deletions

View File

@ -193,10 +193,13 @@ class APISelect(SelectWithDisabled):
:param name: The name of the query param
:param value: The value of the query param
"""
key = 'data-additional-query-param-{}'.format(name)
key = f'data-additional-query-param-{name}'
values = json.loads(self.attrs.get(key, '[]'))
values.append(value)
if type(value) is list:
values.extend(value)
else:
values.append(value)
self.attrs[key] = json.dumps(values)