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

Fixes #3840: Only show valid interface VLAN choices

This commit is contained in:
Saria Hajjar
2020-01-15 12:23:34 +00:00
parent 823e1280d2
commit 9d846d7b87
4 changed files with 55 additions and 16 deletions

View File

@@ -346,12 +346,17 @@ class APISelect(SelectWithDisabled):
def add_additional_query_param(self, name, value):
"""
Add details for an additional query param in the form of a data-* attribute.
Add details for an additional query param in the form of a data-* JSON-encoded list attribute.
:param name: The name of the query param
:param value: The value of the query param
"""
self.attrs['data-additional-query-param-{}'.format(name)] = value
key = 'data-additional-query-param-{}'.format(name)
values = json.loads(self.attrs.get(key, '[]'))
values.append(value)
self.attrs[key] = json.dumps(values)
def add_conditional_query_param(self, condition, value):
"""