mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Fixes: #4255 - Add new script variable types based on dynamic model fields
This commit is contained in:
parent
d9dcc92300
commit
d0bd1ad25b
@ -18,6 +18,7 @@ from ipam.formfields import IPAddressFormField, IPNetworkFormField
|
||||
from ipam.validators import MaxPrefixLengthValidator, MinPrefixLengthValidator, prefix_validator
|
||||
from .constants import LOG_DEFAULT, LOG_FAILURE, LOG_INFO, LOG_SUCCESS, LOG_WARNING
|
||||
from utilities.exceptions import AbortTransaction
|
||||
from utilities.forms import DynamicModelChoiceField, DynamicModelMultipleChoiceField
|
||||
from .forms import ScriptForm
|
||||
from .signals import purge_changelog
|
||||
|
||||
@ -197,6 +198,20 @@ class MultiObjectVar(ScriptVariable):
|
||||
self.form_field = TreeNodeMultipleChoiceField
|
||||
|
||||
|
||||
class DynamicObjectVar(ObjectVar):
|
||||
"""
|
||||
A dynamic netbox object variable. APISelect will determine the available choices
|
||||
"""
|
||||
form_field = DynamicModelChoiceField
|
||||
|
||||
|
||||
class DynamicMultiObjectVar(MultiObjectVar):
|
||||
"""
|
||||
A multiple choice version of DynamicObjectVar
|
||||
"""
|
||||
form_field = DynamicModelMultipleChoiceField
|
||||
|
||||
|
||||
class FileVar(ScriptVariable):
|
||||
"""
|
||||
An uploaded file.
|
||||
|
Loading…
Reference in New Issue
Block a user