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

Closes #4885: Add MultiChoiceVar for custom scripts

This commit is contained in:
Jeremy Stretch
2020-08-11 13:23:39 -04:00
parent 8709c50a9e
commit 3c395e7c9f
4 changed files with 54 additions and 9 deletions

View File

@ -32,6 +32,7 @@ __all__ = [
'IPAddressVar',
'IPAddressWithMaskVar',
'IPNetworkVar',
'MultiChoiceVar',
'MultiObjectVar',
'ObjectVar',
'Script',
@ -165,6 +166,13 @@ class ChoiceVar(ScriptVariable):
self.field_attrs['choices'] = choices
class MultiChoiceVar(ChoiceVar):
"""
Like ChoiceVar, but allows for the selection of multiple choices.
"""
form_field = forms.MultipleChoiceField
class ObjectVar(ScriptVariable):
"""
A single object within NetBox.