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

Merge pull request #3925 from hSaria/3840-limit-vlan-choices

Fixes #3840: Only show valid interface VLAN choices
This commit is contained in:
Jeremy Stretch
2020-02-14 11:48:29 -05:00
committed by GitHub
4 changed files with 96 additions and 113 deletions

View File

@ -309,12 +309,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):
"""