mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Use FieldSet instances for all forms
This commit is contained in:
@@ -13,6 +13,7 @@ from utilities.forms import add_blank_choice
|
||||
from utilities.forms.fields import (
|
||||
CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, NumericArrayField,
|
||||
)
|
||||
from utilities.forms.rendering import FieldSet
|
||||
from utilities.forms.widgets import BulkEditNullBooleanSelect
|
||||
from virtualization.models import Cluster, ClusterGroup
|
||||
|
||||
@@ -55,7 +56,7 @@ class VRFBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = VRF
|
||||
fieldsets = (
|
||||
(None, ('tenant', 'enforce_unique', 'description')),
|
||||
FieldSet('tenant', 'enforce_unique', 'description'),
|
||||
)
|
||||
nullable_fields = ('tenant', 'description', 'comments')
|
||||
|
||||
@@ -75,7 +76,7 @@ class RouteTargetBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = RouteTarget
|
||||
fieldsets = (
|
||||
(None, ('tenant', 'description')),
|
||||
FieldSet('tenant', 'description'),
|
||||
)
|
||||
nullable_fields = ('tenant', 'description', 'comments')
|
||||
|
||||
@@ -94,7 +95,7 @@ class RIRBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = RIR
|
||||
fieldsets = (
|
||||
(None, ('is_private', 'description')),
|
||||
FieldSet('is_private', 'description'),
|
||||
)
|
||||
nullable_fields = ('is_private', 'description')
|
||||
|
||||
@@ -118,7 +119,7 @@ class ASNRangeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = ASNRange
|
||||
fieldsets = (
|
||||
(None, ('rir', 'tenant', 'description')),
|
||||
FieldSet('rir', 'tenant', 'description'),
|
||||
)
|
||||
nullable_fields = ('description',)
|
||||
|
||||
@@ -148,7 +149,7 @@ class ASNBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = ASN
|
||||
fieldsets = (
|
||||
(None, ('sites', 'rir', 'tenant', 'description')),
|
||||
FieldSet('sites', 'rir', 'tenant', 'description'),
|
||||
)
|
||||
nullable_fields = ('tenant', 'description', 'comments')
|
||||
|
||||
@@ -177,7 +178,7 @@ class AggregateBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Aggregate
|
||||
fieldsets = (
|
||||
(None, ('rir', 'tenant', 'date_added', 'description')),
|
||||
FieldSet('rir', 'tenant', 'date_added', 'description'),
|
||||
)
|
||||
nullable_fields = ('date_added', 'description', 'comments')
|
||||
|
||||
@@ -195,7 +196,7 @@ class RoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Role
|
||||
fieldsets = (
|
||||
(None, ('weight', 'description')),
|
||||
FieldSet('weight', 'description'),
|
||||
)
|
||||
nullable_fields = ('description',)
|
||||
|
||||
@@ -265,9 +266,9 @@ class PrefixBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Prefix
|
||||
fieldsets = (
|
||||
(None, ('tenant', 'status', 'role', 'description')),
|
||||
(_('Site'), ('region', 'site_group', 'site')),
|
||||
(_('Addressing'), ('vrf', 'prefix_length', 'is_pool', 'mark_utilized')),
|
||||
FieldSet('tenant', 'status', 'role', 'description'),
|
||||
FieldSet('region', 'site_group', 'site', name=_('Site')),
|
||||
FieldSet('vrf', 'prefix_length', 'is_pool', 'mark_utilized', name=_('Addressing')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'site', 'vrf', 'tenant', 'role', 'description', 'comments',
|
||||
@@ -309,7 +310,7 @@ class IPRangeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = IPRange
|
||||
fieldsets = (
|
||||
(None, ('status', 'role', 'vrf', 'tenant', 'mark_utilized', 'description')),
|
||||
FieldSet('status', 'role', 'vrf', 'tenant', 'mark_utilized', 'description'),
|
||||
)
|
||||
nullable_fields = (
|
||||
'vrf', 'tenant', 'role', 'description', 'comments',
|
||||
@@ -357,8 +358,8 @@ class IPAddressBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = IPAddress
|
||||
fieldsets = (
|
||||
(None, ('status', 'role', 'tenant', 'description')),
|
||||
(_('Addressing'), ('vrf', 'mask_length', 'dns_name')),
|
||||
FieldSet('status', 'role', 'tenant', 'description'),
|
||||
FieldSet('vrf', 'mask_length', 'dns_name', name=_('Addressing')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'vrf', 'role', 'tenant', 'dns_name', 'description', 'comments',
|
||||
@@ -400,8 +401,8 @@ class FHRPGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = FHRPGroup
|
||||
fieldsets = (
|
||||
(None, ('protocol', 'group_id', 'name', 'description')),
|
||||
(_('Authentication'), ('auth_type', 'auth_key')),
|
||||
FieldSet('protocol', 'group_id', 'name', 'description'),
|
||||
FieldSet('auth_type', 'auth_key', name=_('Authentication')),
|
||||
)
|
||||
nullable_fields = ('auth_type', 'auth_key', 'name', 'description', 'comments')
|
||||
|
||||
@@ -485,8 +486,10 @@ class VLANGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = VLANGroup
|
||||
fieldsets = (
|
||||
(None, ('site', 'min_vid', 'max_vid', 'description')),
|
||||
(_('Scope'), ('scope_type', 'region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster')),
|
||||
FieldSet('site', 'min_vid', 'max_vid', 'description'),
|
||||
FieldSet(
|
||||
'scope_type', 'region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster', name=_('Scope')
|
||||
),
|
||||
)
|
||||
nullable_fields = ('description',)
|
||||
|
||||
@@ -556,8 +559,8 @@ class VLANBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = VLAN
|
||||
fieldsets = (
|
||||
(None, ('status', 'role', 'tenant', 'description')),
|
||||
(_('Site & Group'), ('region', 'site_group', 'site', 'group')),
|
||||
FieldSet('status', 'role', 'tenant', 'description'),
|
||||
FieldSet('region', 'site_group', 'site', 'group', name=_('Site & Group')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'site', 'group', 'tenant', 'role', 'description', 'comments',
|
||||
@@ -587,7 +590,7 @@ class ServiceTemplateBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = ServiceTemplate
|
||||
fieldsets = (
|
||||
(None, ('protocol', 'ports', 'description')),
|
||||
FieldSet('protocol', 'ports', 'description'),
|
||||
)
|
||||
nullable_fields = ('description', 'comments')
|
||||
|
||||
|
@@ -9,6 +9,7 @@ from netbox.forms import NetBoxModelFilterSetForm
|
||||
from tenancy.forms import TenancyFilterForm
|
||||
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
|
||||
from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultipleChoiceField, TagFilterField
|
||||
from utilities.forms.rendering import FieldSet
|
||||
from virtualization.models import VirtualMachine
|
||||
from vpn.models import L2VPN
|
||||
|
||||
@@ -42,9 +43,9 @@ IPADDRESS_MASK_LENGTH_CHOICES = add_blank_choice([
|
||||
class VRFFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = VRF
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Route Targets'), ('import_target_id', 'export_target_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('import_target_id', 'export_target_id', name=_('Route Targets')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
import_target_id = DynamicModelMultipleChoiceField(
|
||||
queryset=RouteTarget.objects.all(),
|
||||
@@ -62,9 +63,9 @@ class VRFFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class RouteTargetFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = RouteTarget
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('VRF'), ('importing_vrf_id', 'exporting_vrf_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('importing_vrf_id', 'exporting_vrf_id', name=_('VRF')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
importing_vrf_id = DynamicModelMultipleChoiceField(
|
||||
queryset=VRF.objects.all(),
|
||||
@@ -94,9 +95,9 @@ class RIRFilterForm(NetBoxModelFilterSetForm):
|
||||
class AggregateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Aggregate
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('family', 'rir_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('family', 'rir_id', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
family = forms.ChoiceField(
|
||||
required=False,
|
||||
@@ -114,9 +115,9 @@ class AggregateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class ASNRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = ASNRange
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Range'), ('rir_id', 'start', 'end')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('rir_id', 'start', 'end', name=_('Range')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
rir_id = DynamicModelMultipleChoiceField(
|
||||
queryset=RIR.objects.all(),
|
||||
@@ -137,9 +138,9 @@ class ASNRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class ASNFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = ASN
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Assignment'), ('rir_id', 'site_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('rir_id', 'site_id', name=_('Assignment')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
rir_id = DynamicModelMultipleChoiceField(
|
||||
queryset=RIR.objects.all(),
|
||||
@@ -162,11 +163,14 @@ class RoleFilterForm(NetBoxModelFilterSetForm):
|
||||
class PrefixFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Prefix
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Addressing'), ('within_include', 'family', 'status', 'role_id', 'mask_length', 'is_pool', 'mark_utilized')),
|
||||
(_('VRF'), ('vrf_id', 'present_in_vrf_id')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet(
|
||||
'within_include', 'family', 'status', 'role_id', 'mask_length', 'is_pool', 'mark_utilized',
|
||||
name=_('Addressing')
|
||||
),
|
||||
FieldSet('vrf_id', 'present_in_vrf_id', name=_('VRF')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', name=_('Location')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
mask_length__lte = forms.IntegerField(
|
||||
widget=forms.HiddenInput()
|
||||
@@ -251,9 +255,9 @@ class PrefixFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class IPRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = IPRange
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('family', 'vrf_id', 'status', 'role_id', 'mark_utilized')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('family', 'vrf_id', 'status', 'role_id', 'mark_utilized', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
family = forms.ChoiceField(
|
||||
required=False,
|
||||
@@ -290,11 +294,14 @@ class IPRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class IPAddressFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = IPAddress
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('parent', 'family', 'status', 'role', 'mask_length', 'assigned_to_interface', 'dns_name')),
|
||||
(_('VRF'), ('vrf_id', 'present_in_vrf_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
(_('Device/VM'), ('device_id', 'virtual_machine_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet(
|
||||
'parent', 'family', 'status', 'role', 'mask_length', 'assigned_to_interface', 'dns_name',
|
||||
name=_('Attributes')
|
||||
),
|
||||
FieldSet('vrf_id', 'present_in_vrf_id', name=_('VRF')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('device_id', 'virtual_machine_id', name=_('Device/VM')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'region_id', 'group_id', 'parent', 'status', 'role')
|
||||
parent = forms.CharField(
|
||||
@@ -364,9 +371,9 @@ class IPAddressFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class FHRPGroupFilterForm(NetBoxModelFilterSetForm):
|
||||
model = FHRPGroup
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'protocol', 'group_id')),
|
||||
(_('Authentication'), ('auth_type', 'auth_key')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'protocol', 'group_id', name=_('Attributes')),
|
||||
FieldSet('auth_type', 'auth_key', name=_('Authentication')),
|
||||
)
|
||||
name = forms.CharField(
|
||||
label=_('Name'),
|
||||
@@ -396,9 +403,9 @@ class FHRPGroupFilterForm(NetBoxModelFilterSetForm):
|
||||
|
||||
class VLANGroupFilterForm(NetBoxModelFilterSetForm):
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region', 'sitegroup', 'site', 'location', 'rack')),
|
||||
(_('VLAN ID'), ('min_vid', 'max_vid')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region', 'sitegroup', 'site', 'location', 'rack', name=_('Location')),
|
||||
FieldSet('min_vid', 'max_vid', name=_('VLAN ID')),
|
||||
)
|
||||
model = VLANGroup
|
||||
region = DynamicModelMultipleChoiceField(
|
||||
@@ -444,10 +451,10 @@ class VLANGroupFilterForm(NetBoxModelFilterSetForm):
|
||||
class VLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = VLAN
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id')),
|
||||
(_('Attributes'), ('group_id', 'status', 'role_id', 'vid', 'l2vpn_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', name=_('Location')),
|
||||
FieldSet('group_id', 'status', 'role_id', 'vid', 'l2vpn_id', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'site_id')
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
@@ -504,8 +511,8 @@ class VLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class ServiceTemplateFilterForm(NetBoxModelFilterSetForm):
|
||||
model = ServiceTemplate
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('protocol', 'port')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('protocol', 'port', name=_('Attributes')),
|
||||
)
|
||||
protocol = forms.ChoiceField(
|
||||
label=_('Protocol'),
|
||||
@@ -522,9 +529,9 @@ class ServiceTemplateFilterForm(NetBoxModelFilterSetForm):
|
||||
class ServiceFilterForm(ServiceTemplateFilterForm):
|
||||
model = Service
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('protocol', 'port')),
|
||||
(_('Assignment'), ('device_id', 'virtual_machine_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('protocol', 'port', name=_('Attributes')),
|
||||
FieldSet('device_id', 'virtual_machine_id', name=_('Assignment')),
|
||||
)
|
||||
device_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
|
@@ -16,7 +16,7 @@ from utilities.forms.fields import (
|
||||
CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, NumericArrayField,
|
||||
SlugField,
|
||||
)
|
||||
from utilities.forms.rendering import InlineFields, ObjectAttribute, TabbedGroups
|
||||
from utilities.forms.rendering import FieldSet, InlineFields, ObjectAttribute, TabbedGroups
|
||||
from utilities.forms.widgets import DatePicker
|
||||
from virtualization.models import Cluster, ClusterGroup, VirtualMachine, VMInterface
|
||||
|
||||
@@ -57,9 +57,9 @@ class VRFForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('VRF'), ('name', 'rd', 'enforce_unique', 'description', 'tags')),
|
||||
(_('Route Targets'), ('import_targets', 'export_targets')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet('name', 'rd', 'enforce_unique', 'description', 'tags', name=_('VRF')),
|
||||
FieldSet('import_targets', 'export_targets', name=_('Route Targets')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -75,8 +75,8 @@ class VRFForm(TenancyForm, NetBoxModelForm):
|
||||
|
||||
class RouteTargetForm(TenancyForm, NetBoxModelForm):
|
||||
fieldsets = (
|
||||
('Route Target', ('name', 'description', 'tags')),
|
||||
('Tenancy', ('tenant_group', 'tenant')),
|
||||
FieldSet('name', 'description', 'tags', name=_('Route Target')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
@@ -91,9 +91,7 @@ class RIRForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('RIR'), (
|
||||
'name', 'slug', 'is_private', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('name', 'slug', 'is_private', 'description', 'tags', name=_('RIR')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -111,8 +109,8 @@ class AggregateForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Aggregate'), ('prefix', 'rir', 'date_added', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet('prefix', 'rir', 'date_added', 'description', 'tags', name=_('Aggregate')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -132,8 +130,8 @@ class ASNRangeForm(TenancyForm, NetBoxModelForm):
|
||||
)
|
||||
slug = SlugField()
|
||||
fieldsets = (
|
||||
(_('ASN Range'), ('name', 'slug', 'rir', 'start', 'end', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet('name', 'slug', 'rir', 'start', 'end', 'description', 'tags', name=_('ASN Range')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -156,8 +154,8 @@ class ASNForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('ASN'), ('asn', 'rir', 'sites', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet('asn', 'rir', 'sites', 'description', 'tags', name=_('ASN')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -185,9 +183,7 @@ class RoleForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Role'), (
|
||||
'name', 'slug', 'weight', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('name', 'slug', 'weight', 'description', 'tags', name=_('Role')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -227,9 +223,11 @@ class PrefixForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Prefix'), ('prefix', 'status', 'vrf', 'role', 'is_pool', 'mark_utilized', 'description', 'tags')),
|
||||
(_('Site/VLAN Assignment'), ('site', 'vlan')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet(
|
||||
'prefix', 'status', 'vrf', 'role', 'is_pool', 'mark_utilized', 'description', 'tags', name=_('Prefix')
|
||||
),
|
||||
FieldSet('site', 'vlan', name=_('Site/VLAN Assignment')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -254,8 +252,11 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('IP Range'), ('vrf', 'start_address', 'end_address', 'role', 'status', 'mark_utilized', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet(
|
||||
'vrf', 'start_address', 'end_address', 'role', 'status', 'mark_utilized', 'description', 'tags',
|
||||
name=_('IP Range')
|
||||
),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -309,17 +310,17 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('IP Address'), ('address', 'status', 'role', 'vrf', 'dns_name', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
(_('Assignment'), (
|
||||
FieldSet('address', 'status', 'role', 'vrf', 'dns_name', 'description', 'tags', name=_('IP Address')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
FieldSet(
|
||||
TabbedGroups(
|
||||
(_('Device'), 'interface'),
|
||||
(_('Virtual Machine'), 'vminterface'),
|
||||
(_('FHRP Group'), 'fhrpgroup'),
|
||||
FieldSet('interface', name=_('Device')),
|
||||
FieldSet('vminterface', name=_('Virtual Machine')),
|
||||
FieldSet('fhrpgroup', name=_('FHRP Group')),
|
||||
),
|
||||
'primary_for_parent',
|
||||
)),
|
||||
(_('NAT IP (Inside)'), ('nat_inside',)),
|
||||
'primary_for_parent', name=_('Assignment')
|
||||
),
|
||||
FieldSet('nat_inside', name=_('NAT IP (Inside)')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -458,9 +459,9 @@ class FHRPGroupForm(NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('FHRP Group'), ('protocol', 'group_id', 'name', 'description', 'tags')),
|
||||
(_('Authentication'), ('auth_type', 'auth_key')),
|
||||
(_('Virtual IP Address'), ('ip_vrf', 'ip_address', 'ip_status'))
|
||||
FieldSet('protocol', 'group_id', 'name', 'description', 'tags', name=_('FHRP Group')),
|
||||
FieldSet('auth_type', 'auth_key', name=_('Authentication')),
|
||||
FieldSet('ip_vrf', 'ip_address', 'ip_status', name=_('Virtual IP Address'))
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -518,7 +519,7 @@ class FHRPGroupAssignmentForm(forms.ModelForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, (ObjectAttribute('interface'), 'group', 'priority')),
|
||||
FieldSet(ObjectAttribute('interface'), 'group', 'priority'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -606,9 +607,12 @@ class VLANGroupForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('VLAN Group'), ('name', 'slug', 'description', 'tags')),
|
||||
(_('Child VLANs'), ('min_vid', 'max_vid')),
|
||||
(_('Scope'), ('scope_type', 'region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster')),
|
||||
FieldSet('name', 'slug', 'description', 'tags', name=_('VLAN Group')),
|
||||
FieldSet('min_vid', 'max_vid', name=_('Child VLANs')),
|
||||
FieldSet(
|
||||
'scope_type', 'region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster',
|
||||
name=_('Scope')
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -681,9 +685,7 @@ class ServiceTemplateForm(NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Service Template'), (
|
||||
'name', 'protocol', 'ports', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('name', 'protocol', 'ports', 'description', 'tags', name=_('Service Template')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -724,17 +726,15 @@ class ServiceForm(NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Service'), (
|
||||
FieldSet(
|
||||
TabbedGroups(
|
||||
(_('Device'), 'device'),
|
||||
(_('Virtual Machine'), 'virtual_machine'),
|
||||
FieldSet('device', name=_('Device')),
|
||||
FieldSet('virtual_machine', name=_('Virtual Machine')),
|
||||
),
|
||||
'name',
|
||||
InlineFields('protocol', 'ports', label=_('Port(s)')),
|
||||
'ipaddresses',
|
||||
'description',
|
||||
'tags',
|
||||
)),
|
||||
'ipaddresses', 'description', 'tags', name=_('Service')
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -752,19 +752,17 @@ class ServiceCreateForm(ServiceForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(_('Service'), (
|
||||
FieldSet(
|
||||
TabbedGroups(
|
||||
(_('Device'), 'device'),
|
||||
(_('Virtual Machine'), 'virtual_machine'),
|
||||
FieldSet('device', name=_('Device')),
|
||||
FieldSet('virtual_machine', name=_('Virtual Machine')),
|
||||
),
|
||||
TabbedGroups(
|
||||
(_('From Template'), 'service_template'),
|
||||
(_('Custom'), 'name', 'protocol', 'ports'),
|
||||
FieldSet('service_template', name=_('From Template')),
|
||||
FieldSet('name', 'protocol', 'ports', name=_('Custom')),
|
||||
),
|
||||
'ipaddresses',
|
||||
'description',
|
||||
'tags',
|
||||
)),
|
||||
'ipaddresses', 'description', 'tags', name=_('Service')
|
||||
),
|
||||
)
|
||||
|
||||
class Meta(ServiceForm.Meta):
|
||||
|
Reference in New Issue
Block a user