mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add IPNetworkVar
This commit is contained in:
@ -7,6 +7,7 @@ from django.conf import settings
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import transaction
|
||||
|
||||
from ipam.formfields import IPFormField
|
||||
from utilities.exceptions import AbortTransaction
|
||||
from .constants import LOG_DEFAULT, LOG_FAILURE, LOG_INFO, LOG_SUCCESS, LOG_WARNING
|
||||
from .forms import ScriptForm
|
||||
@ -18,6 +19,7 @@ __all__ = [
|
||||
'IntegerVar',
|
||||
'BooleanVar',
|
||||
'ObjectVar',
|
||||
'IPNetworkVar',
|
||||
]
|
||||
|
||||
|
||||
@ -116,6 +118,17 @@ class ObjectVar(ScriptVariable):
|
||||
self.field_attrs['queryset'] = queryset
|
||||
|
||||
|
||||
class IPNetworkVar(ScriptVariable):
|
||||
"""
|
||||
An IPv4 or IPv6 prefix.
|
||||
"""
|
||||
form_field = IPFormField
|
||||
|
||||
|
||||
#
|
||||
# Scripts
|
||||
#
|
||||
|
||||
class Script:
|
||||
"""
|
||||
Custom scripts inherit this object.
|
||||
|
Reference in New Issue
Block a user