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 netbox.forms import NetBoxModelBulkEditForm
|
||||
from tenancy.models import Tenant
|
||||
from utilities.forms import BulkEditForm, add_blank_choice, form_from_model
|
||||
from utilities.forms.fields import ColorField, CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField
|
||||
from utilities.forms.rendering import FieldSet
|
||||
from utilities.forms.widgets import BulkEditNullBooleanSelect, NumberWithOptions
|
||||
from wireless.models import WirelessLAN, WirelessLANGroup
|
||||
from wireless.choices import WirelessRoleChoices
|
||||
@@ -75,7 +76,7 @@ class RegionBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Region
|
||||
fieldsets = (
|
||||
(None, ('parent', 'description')),
|
||||
FieldSet('parent', 'description'),
|
||||
)
|
||||
nullable_fields = ('parent', 'description')
|
||||
|
||||
@@ -94,7 +95,7 @@ class SiteGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = SiteGroup
|
||||
fieldsets = (
|
||||
(None, ('parent', 'description')),
|
||||
FieldSet('parent', 'description'),
|
||||
)
|
||||
nullable_fields = ('parent', 'description')
|
||||
|
||||
@@ -154,7 +155,7 @@ class SiteBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Site
|
||||
fieldsets = (
|
||||
(None, ('status', 'region', 'group', 'tenant', 'asns', 'time_zone', 'description')),
|
||||
FieldSet('status', 'region', 'group', 'tenant', 'asns', 'time_zone', 'description'),
|
||||
)
|
||||
nullable_fields = (
|
||||
'region', 'group', 'tenant', 'asns', 'time_zone', 'description', 'comments',
|
||||
@@ -194,7 +195,7 @@ class LocationBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Location
|
||||
fieldsets = (
|
||||
(None, ('site', 'parent', 'status', 'tenant', 'description')),
|
||||
FieldSet('site', 'parent', 'status', 'tenant', 'description'),
|
||||
)
|
||||
nullable_fields = ('parent', 'tenant', 'description')
|
||||
|
||||
@@ -212,7 +213,7 @@ class RackRoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = RackRole
|
||||
fieldsets = (
|
||||
(None, ('color', 'description')),
|
||||
FieldSet('color', 'description'),
|
||||
)
|
||||
nullable_fields = ('color', 'description')
|
||||
|
||||
@@ -341,12 +342,13 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Rack
|
||||
fieldsets = (
|
||||
(_('Rack'), ('status', 'role', 'tenant', 'serial', 'asset_tag', 'description')),
|
||||
(_('Location'), ('region', 'site_group', 'site', 'location')),
|
||||
(_('Hardware'), (
|
||||
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'description', name=_('Rack')),
|
||||
FieldSet('region', 'site_group', 'site', 'location', name=_('Location')),
|
||||
FieldSet(
|
||||
'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth',
|
||||
)),
|
||||
(_('Weight'), ('weight', 'max_weight', 'weight_unit')),
|
||||
name=_('Hardware')
|
||||
),
|
||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'weight',
|
||||
@@ -376,7 +378,7 @@ class RackReservationBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = RackReservation
|
||||
fieldsets = (
|
||||
(None, ('user', 'tenant', 'description')),
|
||||
FieldSet('user', 'tenant', 'description'),
|
||||
)
|
||||
nullable_fields = ('comments',)
|
||||
|
||||
@@ -390,7 +392,7 @@ class ManufacturerBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Manufacturer
|
||||
fieldsets = (
|
||||
(None, ('description',)),
|
||||
FieldSet('description'),
|
||||
)
|
||||
nullable_fields = ('description',)
|
||||
|
||||
@@ -450,11 +452,11 @@ class DeviceTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = DeviceType
|
||||
fieldsets = (
|
||||
(_('Device Type'), (
|
||||
FieldSet(
|
||||
'manufacturer', 'default_platform', 'part_number', 'u_height', 'exclude_from_utilization', 'is_full_depth',
|
||||
'airflow', 'description',
|
||||
)),
|
||||
(_('Weight'), ('weight', 'weight_unit')),
|
||||
'airflow', 'description', name=_('Device Type')
|
||||
),
|
||||
FieldSet('weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
nullable_fields = ('part_number', 'airflow', 'weight', 'weight_unit', 'description', 'comments')
|
||||
|
||||
@@ -489,8 +491,8 @@ class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = ModuleType
|
||||
fieldsets = (
|
||||
(_('Module Type'), ('manufacturer', 'part_number', 'description')),
|
||||
(_('Weight'), ('weight', 'weight_unit')),
|
||||
FieldSet('manufacturer', 'part_number', 'description', name=_('Module Type')),
|
||||
FieldSet('weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
nullable_fields = ('part_number', 'weight', 'weight_unit', 'description', 'comments')
|
||||
|
||||
@@ -518,7 +520,7 @@ class DeviceRoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = DeviceRole
|
||||
fieldsets = (
|
||||
(None, ('color', 'vm_role', 'config_template', 'description')),
|
||||
FieldSet('color', 'vm_role', 'config_template', 'description'),
|
||||
)
|
||||
nullable_fields = ('color', 'config_template', 'description')
|
||||
|
||||
@@ -542,7 +544,7 @@ class PlatformBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Platform
|
||||
fieldsets = (
|
||||
(None, ('manufacturer', 'config_template', 'description')),
|
||||
FieldSet('manufacturer', 'config_template', 'description'),
|
||||
)
|
||||
nullable_fields = ('manufacturer', 'config_template', 'description')
|
||||
|
||||
@@ -621,10 +623,10 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Device
|
||||
fieldsets = (
|
||||
(_('Device'), ('role', 'status', 'tenant', 'platform', 'description')),
|
||||
(_('Location'), ('site', 'location')),
|
||||
(_('Hardware'), ('manufacturer', 'device_type', 'airflow', 'serial')),
|
||||
(_('Configuration'), ('config_template',)),
|
||||
FieldSet('role', 'status', 'tenant', 'platform', 'description', name=_('Device')),
|
||||
FieldSet('site', 'location', name=_('Location')),
|
||||
FieldSet('manufacturer', 'device_type', 'airflow', 'serial', name=_('Hardware')),
|
||||
FieldSet('config_template', name=_('Configuration')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'location', 'tenant', 'platform', 'serial', 'airflow', 'description', 'comments',
|
||||
@@ -668,7 +670,7 @@ class ModuleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Module
|
||||
fieldsets = (
|
||||
(None, ('manufacturer', 'module_type', 'status', 'serial', 'description')),
|
||||
FieldSet('manufacturer', 'module_type', 'status', 'serial', 'description'),
|
||||
)
|
||||
nullable_fields = ('serial', 'description', 'comments')
|
||||
|
||||
@@ -720,8 +722,8 @@ class CableBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Cable
|
||||
fieldsets = (
|
||||
(None, ('type', 'status', 'tenant', 'label', 'description')),
|
||||
(_('Attributes'), ('color', 'length', 'length_unit')),
|
||||
FieldSet('type', 'status', 'tenant', 'label', 'description'),
|
||||
FieldSet('color', 'length', 'length_unit', name=_('Attributes')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'type', 'status', 'tenant', 'label', 'color', 'length', 'description', 'comments',
|
||||
@@ -743,7 +745,7 @@ class VirtualChassisBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = VirtualChassis
|
||||
fieldsets = (
|
||||
(None, ('domain', 'description')),
|
||||
FieldSet('domain', 'description'),
|
||||
)
|
||||
nullable_fields = ('domain', 'description', 'comments')
|
||||
|
||||
@@ -791,7 +793,7 @@ class PowerPanelBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = PowerPanel
|
||||
fieldsets = (
|
||||
(None, ('region', 'site_group', 'site', 'location', 'description')),
|
||||
FieldSet('region', 'site_group', 'site', 'location', 'description'),
|
||||
)
|
||||
nullable_fields = ('location', 'description', 'comments')
|
||||
|
||||
@@ -861,8 +863,8 @@ class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = PowerFeed
|
||||
fieldsets = (
|
||||
(None, ('power_panel', 'rack', 'status', 'type', 'mark_connected', 'description', 'tenant')),
|
||||
(_('Power'), ('supply', 'phase', 'voltage', 'amperage', 'max_utilization'))
|
||||
FieldSet('power_panel', 'rack', 'status', 'type', 'mark_connected', 'description', 'tenant'),
|
||||
FieldSet('supply', 'phase', 'voltage', 'amperage', 'max_utilization', name=_('Power'))
|
||||
)
|
||||
nullable_fields = ('location', 'tenant', 'description', 'comments')
|
||||
|
||||
@@ -1210,7 +1212,7 @@ class ConsolePortBulkEditForm(
|
||||
|
||||
model = ConsolePort
|
||||
fieldsets = (
|
||||
(None, ('module', 'type', 'label', 'speed', 'description', 'mark_connected')),
|
||||
FieldSet('module', 'type', 'label', 'speed', 'description', 'mark_connected'),
|
||||
)
|
||||
nullable_fields = ('module', 'label', 'description')
|
||||
|
||||
@@ -1227,7 +1229,7 @@ class ConsoleServerPortBulkEditForm(
|
||||
|
||||
model = ConsoleServerPort
|
||||
fieldsets = (
|
||||
(None, ('module', 'type', 'label', 'speed', 'description', 'mark_connected')),
|
||||
FieldSet('module', 'type', 'label', 'speed', 'description', 'mark_connected'),
|
||||
)
|
||||
nullable_fields = ('module', 'label', 'description')
|
||||
|
||||
@@ -1244,8 +1246,8 @@ class PowerPortBulkEditForm(
|
||||
|
||||
model = PowerPort
|
||||
fieldsets = (
|
||||
(None, ('module', 'type', 'label', 'description', 'mark_connected')),
|
||||
(_('Power'), ('maximum_draw', 'allocated_draw')),
|
||||
FieldSet('module', 'type', 'label', 'description', 'mark_connected'),
|
||||
FieldSet('maximum_draw', 'allocated_draw', name=_('Power')),
|
||||
)
|
||||
nullable_fields = ('module', 'label', 'description', 'maximum_draw', 'allocated_draw')
|
||||
|
||||
@@ -1262,8 +1264,8 @@ class PowerOutletBulkEditForm(
|
||||
|
||||
model = PowerOutlet
|
||||
fieldsets = (
|
||||
(None, ('module', 'type', 'label', 'description', 'mark_connected')),
|
||||
(_('Power'), ('feed_leg', 'power_port')),
|
||||
FieldSet('module', 'type', 'label', 'description', 'mark_connected'),
|
||||
FieldSet('feed_leg', 'power_port', name=_('Power')),
|
||||
)
|
||||
nullable_fields = ('module', 'label', 'type', 'feed_leg', 'power_port', 'description')
|
||||
|
||||
@@ -1395,20 +1397,21 @@ class InterfaceBulkEditForm(
|
||||
|
||||
model = Interface
|
||||
fieldsets = (
|
||||
(None, ('module', 'type', 'label', 'speed', 'duplex', 'description')),
|
||||
(_('Addressing'), ('vrf', 'mac_address', 'wwn')),
|
||||
(_('Operation'), ('vdcs', 'mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected')),
|
||||
(_('PoE'), ('poe_mode', 'poe_type')),
|
||||
(_('Related Interfaces'), ('parent', 'bridge', 'lag')),
|
||||
(_('802.1Q Switching'), ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')),
|
||||
(_('Wireless'), (
|
||||
FieldSet('module', 'type', 'label', 'speed', 'duplex', 'description'),
|
||||
FieldSet('vrf', 'mac_address', 'wwn', name=_('Addressing')),
|
||||
FieldSet('vdcs', 'mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected', name=_('Operation')),
|
||||
FieldSet('poe_mode', 'poe_type', name=_('PoE')),
|
||||
FieldSet('parent', 'bridge', 'lag', name=_('Related Interfaces')),
|
||||
FieldSet('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', name=_('802.1Q Switching')),
|
||||
FieldSet(
|
||||
'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'wireless_lan_group', 'wireless_lans',
|
||||
)),
|
||||
name=_('Wireless')
|
||||
),
|
||||
)
|
||||
nullable_fields = (
|
||||
'module', 'label', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'vdcs', 'mtu', 'description',
|
||||
'poe_mode', 'poe_type', 'mode', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'untagged_vlan',
|
||||
'tagged_vlans', 'vrf', 'wireless_lans'
|
||||
'module', 'label', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'vdcs', 'mtu',
|
||||
'description', 'poe_mode', 'poe_type', 'mode', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width',
|
||||
'tx_power', 'untagged_vlan', 'tagged_vlans', 'vrf', 'wireless_lans'
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -1488,7 +1491,7 @@ class FrontPortBulkEditForm(
|
||||
|
||||
model = FrontPort
|
||||
fieldsets = (
|
||||
(None, ('module', 'type', 'label', 'color', 'description', 'mark_connected')),
|
||||
FieldSet('module', 'type', 'label', 'color', 'description', 'mark_connected'),
|
||||
)
|
||||
nullable_fields = ('module', 'label', 'description', 'color')
|
||||
|
||||
@@ -1505,7 +1508,7 @@ class RearPortBulkEditForm(
|
||||
|
||||
model = RearPort
|
||||
fieldsets = (
|
||||
(None, ('module', 'type', 'label', 'color', 'description', 'mark_connected')),
|
||||
FieldSet('module', 'type', 'label', 'color', 'description', 'mark_connected'),
|
||||
)
|
||||
nullable_fields = ('module', 'label', 'description', 'color')
|
||||
|
||||
@@ -1516,7 +1519,7 @@ class ModuleBayBulkEditForm(
|
||||
):
|
||||
model = ModuleBay
|
||||
fieldsets = (
|
||||
(None, ('label', 'position', 'description')),
|
||||
FieldSet('label', 'position', 'description'),
|
||||
)
|
||||
nullable_fields = ('label', 'position', 'description')
|
||||
|
||||
@@ -1527,7 +1530,7 @@ class DeviceBayBulkEditForm(
|
||||
):
|
||||
model = DeviceBay
|
||||
fieldsets = (
|
||||
(None, ('label', 'description')),
|
||||
FieldSet('label', 'description'),
|
||||
)
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
@@ -1554,7 +1557,7 @@ class InventoryItemBulkEditForm(
|
||||
|
||||
model = InventoryItem
|
||||
fieldsets = (
|
||||
(None, ('device', 'label', 'role', 'manufacturer', 'part_id', 'description')),
|
||||
FieldSet('device', 'label', 'role', 'manufacturer', 'part_id', 'description'),
|
||||
)
|
||||
nullable_fields = ('label', 'role', 'manufacturer', 'part_id', 'description')
|
||||
|
||||
@@ -1576,7 +1579,7 @@ class InventoryItemRoleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = InventoryItemRole
|
||||
fieldsets = (
|
||||
(None, ('color', 'description')),
|
||||
FieldSet('color', 'description'),
|
||||
)
|
||||
nullable_fields = ('color', 'description')
|
||||
|
||||
@@ -1599,6 +1602,6 @@ class VirtualDeviceContextBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
model = VirtualDeviceContext
|
||||
fieldsets = (
|
||||
(None, ('device', 'status', 'tenant')),
|
||||
FieldSet('device', 'status', 'tenant'),
|
||||
)
|
||||
nullable_fields = ('device', 'tenant', )
|
||||
|
@@ -12,7 +12,8 @@ from netbox.forms import NetBoxModelFilterSetForm
|
||||
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
||||
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, FilterForm, add_blank_choice
|
||||
from utilities.forms.fields import ColorField, DynamicModelMultipleChoiceField, TagFilterField
|
||||
from utilities.forms.widgets import APISelectMultiple, NumberWithOptions
|
||||
from utilities.forms.rendering import FieldSet
|
||||
from utilities.forms.widgets import NumberWithOptions
|
||||
from vpn.models import L2VPN
|
||||
from wireless.choices import *
|
||||
|
||||
@@ -132,8 +133,8 @@ class DeviceComponentFilterForm(NetBoxModelFilterSetForm):
|
||||
class RegionFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Region
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag', 'parent_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group'))
|
||||
FieldSet('q', 'filter_id', 'tag', 'parent_id'),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts'))
|
||||
)
|
||||
parent_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@@ -146,8 +147,8 @@ class RegionFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
class SiteGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = SiteGroup
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag', 'parent_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group'))
|
||||
FieldSet('q', 'filter_id', 'tag', 'parent_id'),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts'))
|
||||
)
|
||||
parent_id = DynamicModelMultipleChoiceField(
|
||||
queryset=SiteGroup.objects.all(),
|
||||
@@ -160,10 +161,10 @@ class SiteGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
class SiteFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Site
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('status', 'region_id', 'group_id', 'asn_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('status', 'region_id', 'group_id', 'asn_id', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'region_id', 'group_id')
|
||||
status = forms.MultipleChoiceField(
|
||||
@@ -192,10 +193,10 @@ class SiteFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilte
|
||||
class LocationFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Location
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('region_id', 'site_group_id', 'site_id', 'parent_id', 'status')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'parent_id', 'status', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@@ -241,13 +242,13 @@ class RackRoleFilterForm(NetBoxModelFilterSetForm):
|
||||
class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Rack
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id')),
|
||||
(_('Function'), ('status', 'role_id')),
|
||||
(_('Hardware'), ('type', 'width', 'serial', 'asset_tag')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group')),
|
||||
(_('Weight'), ('weight', 'max_weight', 'weight_unit')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Location')),
|
||||
FieldSet('status', 'role_id', name=_('Function')),
|
||||
FieldSet('type', 'width', 'serial', 'asset_tag', name=_('Hardware')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'region_id', 'site_group_id', 'site_id', 'location_id')
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
@@ -326,13 +327,13 @@ class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilte
|
||||
|
||||
class RackElevationFilterForm(RackFilterForm):
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'id')),
|
||||
(_('Function'), ('status', 'role_id')),
|
||||
(_('Hardware'), ('type', 'width', 'serial', 'asset_tag')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group')),
|
||||
(_('Weight'), ('weight', 'max_weight', 'weight_unit')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'id', name=_('Location')),
|
||||
FieldSet('status', 'role_id', name=_('Function')),
|
||||
FieldSet('type', 'width', 'serial', 'asset_tag', name=_('Hardware')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
id = DynamicModelMultipleChoiceField(
|
||||
queryset=Rack.objects.all(),
|
||||
@@ -348,10 +349,10 @@ class RackElevationFilterForm(RackFilterForm):
|
||||
class RackReservationFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = RackReservation
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('User'), ('user_id',)),
|
||||
(_('Rack'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('user_id', name=_('User')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Rack')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@@ -401,8 +402,8 @@ class RackReservationFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class ManufacturerFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Manufacturer
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group'))
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts'))
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
@@ -410,14 +411,16 @@ class ManufacturerFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
class DeviceTypeFilterForm(NetBoxModelFilterSetForm):
|
||||
model = DeviceType
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Hardware'), ('manufacturer_id', 'default_platform_id', 'part_number', 'subdevice_role', 'airflow')),
|
||||
(_('Images'), ('has_front_image', 'has_rear_image')),
|
||||
(_('Components'), (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet(
|
||||
'manufacturer_id', 'default_platform_id', 'part_number', 'subdevice_role', 'airflow', name=_('Hardware')
|
||||
),
|
||||
FieldSet('has_front_image', 'has_rear_image', name=_('Images')),
|
||||
FieldSet(
|
||||
'console_ports', 'console_server_ports', 'power_ports', 'power_outlets', 'interfaces',
|
||||
'pass_through_ports', 'device_bays', 'module_bays', 'inventory_items',
|
||||
)),
|
||||
(_('Weight'), ('weight', 'weight_unit')),
|
||||
'pass_through_ports', 'device_bays', 'module_bays', 'inventory_items', name=_('Components')
|
||||
),
|
||||
FieldSet('weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'manufacturer_id')
|
||||
manufacturer_id = DynamicModelMultipleChoiceField(
|
||||
@@ -536,13 +539,13 @@ class DeviceTypeFilterForm(NetBoxModelFilterSetForm):
|
||||
class ModuleTypeFilterForm(NetBoxModelFilterSetForm):
|
||||
model = ModuleType
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Hardware'), ('manufacturer_id', 'part_number')),
|
||||
(_('Components'), (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('manufacturer_id', 'part_number', name=_('Hardware')),
|
||||
FieldSet(
|
||||
'console_ports', 'console_server_ports', 'power_ports', 'power_outlets', 'interfaces',
|
||||
'pass_through_ports',
|
||||
)),
|
||||
(_('Weight'), ('weight', 'weight_unit')),
|
||||
'pass_through_ports', name=_('Components')
|
||||
),
|
||||
FieldSet('weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'manufacturer_id')
|
||||
manufacturer_id = DynamicModelMultipleChoiceField(
|
||||
@@ -642,18 +645,20 @@ class DeviceFilterForm(
|
||||
):
|
||||
model = Device
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Operation'), ('status', 'role_id', 'airflow', 'serial', 'asset_tag', 'mac_address')),
|
||||
(_('Hardware'), ('manufacturer_id', 'device_type_id', 'platform_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group')),
|
||||
(_('Components'), (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('status', 'role_id', 'airflow', 'serial', 'asset_tag', 'mac_address', name=_('Operation')),
|
||||
FieldSet('manufacturer_id', 'device_type_id', 'platform_id', name=_('Hardware')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
FieldSet(
|
||||
'console_ports', 'console_server_ports', 'power_ports', 'power_outlets', 'interfaces', 'pass_through_ports',
|
||||
)),
|
||||
(_('Miscellaneous'), (
|
||||
name=_('Components')
|
||||
),
|
||||
FieldSet(
|
||||
'has_primary_ip', 'has_oob_ip', 'virtual_chassis_member', 'config_template_id', 'local_context_data',
|
||||
))
|
||||
name=_('Miscellaneous')
|
||||
)
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
@@ -817,9 +822,9 @@ class VirtualDeviceContextFilterForm(
|
||||
):
|
||||
model = VirtualDeviceContext
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('device', 'status', 'has_primary_ip')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('device', 'status', 'has_primary_ip', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
device = DynamicModelMultipleChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
@@ -844,8 +849,8 @@ class VirtualDeviceContextFilterForm(
|
||||
class ModuleFilterForm(LocalConfigContextFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Module
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Hardware'), ('manufacturer_id', 'module_type_id', 'status', 'serial', 'asset_tag')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('manufacturer_id', 'module_type_id', 'status', 'serial', 'asset_tag', name=_('Hardware')),
|
||||
)
|
||||
manufacturer_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Manufacturer.objects.all(),
|
||||
@@ -879,9 +884,9 @@ class ModuleFilterForm(LocalConfigContextFilterForm, TenancyFilterForm, NetBoxMo
|
||||
class VirtualChassisFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = VirtualChassis
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', name=_('Location')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@@ -908,10 +913,10 @@ class VirtualChassisFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class CableFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = Cable
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('site_id', 'location_id', 'rack_id', 'device_id')),
|
||||
(_('Attributes'), ('type', 'status', 'color', 'length', 'length_unit', 'unterminated')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('site_id', 'location_id', 'rack_id', 'device_id', name=_('Location')),
|
||||
FieldSet('type', 'status', 'color', 'length', 'length_unit', 'unterminated', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@@ -992,9 +997,9 @@ class CableFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class PowerPanelFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
model = PowerPanel
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id')),
|
||||
(_('Contacts'), ('contact', 'contact_role', 'contact_group')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Location')),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'site_id', 'location_id')
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
@@ -1031,10 +1036,10 @@ class PowerPanelFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
class PowerFeedFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
model = PowerFeed
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'power_panel_id', 'rack_id')),
|
||||
(_('Tenant'), ('tenant_group_id', 'tenant_id')),
|
||||
(_('Attributes'), ('status', 'type', 'supply', 'phase', 'voltage', 'amperage', 'max_utilization')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'power_panel_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('status', 'type', 'supply', 'phase', 'voltage', 'amperage', 'max_utilization', name=_('Attributes')),
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@@ -1141,11 +1146,11 @@ class PathEndpointFilterForm(CabledFilterForm):
|
||||
class ConsolePortFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
model = ConsolePort
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'type', 'speed')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
(_('Connection'), ('cabled', 'connected', 'occupied')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'type', 'speed', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
FieldSet('cabled', 'connected', 'occupied', name=_('Connection')),
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
label=_('Type'),
|
||||
@@ -1163,11 +1168,11 @@ class ConsolePortFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
class ConsoleServerPortFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
model = ConsoleServerPort
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'type', 'speed')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
(_('Connection'), ('cabled', 'connected', 'occupied')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'type', 'speed', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
FieldSet('cabled', 'connected', 'occupied', name=_('Connection')),
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
label=_('Type'),
|
||||
@@ -1185,11 +1190,11 @@ class ConsoleServerPortFilterForm(PathEndpointFilterForm, DeviceComponentFilterF
|
||||
class PowerPortFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
model = PowerPort
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'type')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
(_('Connection'), ('cabled', 'connected', 'occupied')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'type', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
FieldSet('cabled', 'connected', 'occupied', name=_('Connection')),
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
label=_('Type'),
|
||||
@@ -1202,11 +1207,11 @@ class PowerPortFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
class PowerOutletFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
model = PowerOutlet
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'type')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
(_('Connection'), ('cabled', 'connected', 'occupied')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'type', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
FieldSet('cabled', 'connected', 'occupied', name=_('Connection')),
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
label=_('Type'),
|
||||
@@ -1219,14 +1224,14 @@ class PowerOutletFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
class InterfaceFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
model = Interface
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'kind', 'type', 'speed', 'duplex', 'enabled', 'mgmt_only')),
|
||||
(_('Addressing'), ('vrf_id', 'l2vpn_id', 'mac_address', 'wwn')),
|
||||
(_('PoE'), ('poe_mode', 'poe_type')),
|
||||
(_('Wireless'), ('rf_role', 'rf_channel', 'rf_channel_width', 'tx_power')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', 'vdc_id')),
|
||||
(_('Connection'), ('cabled', 'connected', 'occupied')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'kind', 'type', 'speed', 'duplex', 'enabled', 'mgmt_only', name=_('Attributes')),
|
||||
FieldSet('vrf_id', 'l2vpn_id', 'mac_address', 'wwn', name=_('Addressing')),
|
||||
FieldSet('poe_mode', 'poe_type', name=_('PoE')),
|
||||
FieldSet('rf_role', 'rf_channel', 'rf_channel_width', 'tx_power', name=_('Wireless')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', 'vdc_id', name=_('Device')),
|
||||
FieldSet('cabled', 'connected', 'occupied', name=_('Connection')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'device_id')
|
||||
vdc_id = DynamicModelMultipleChoiceField(
|
||||
@@ -1330,11 +1335,11 @@ class InterfaceFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
|
||||
|
||||
class FrontPortFilterForm(CabledFilterForm, DeviceComponentFilterForm):
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'type', 'color')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
(_('Cable'), ('cabled', 'occupied')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'type', 'color', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
FieldSet('cabled', 'occupied', name=_('Cable')),
|
||||
)
|
||||
model = FrontPort
|
||||
type = forms.MultipleChoiceField(
|
||||
@@ -1352,11 +1357,11 @@ class FrontPortFilterForm(CabledFilterForm, DeviceComponentFilterForm):
|
||||
class RearPortFilterForm(CabledFilterForm, DeviceComponentFilterForm):
|
||||
model = RearPort
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'type', 'color')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
(_('Cable'), ('cabled', 'occupied')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'type', 'color', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
FieldSet('cabled', 'occupied', name=_('Cable')),
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
label=_('Type'),
|
||||
@@ -1373,10 +1378,10 @@ class RearPortFilterForm(CabledFilterForm, DeviceComponentFilterForm):
|
||||
class ModuleBayFilterForm(DeviceComponentFilterForm):
|
||||
model = ModuleBay
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'position')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', 'position', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
position = forms.CharField(
|
||||
@@ -1388,10 +1393,10 @@ class ModuleBayFilterForm(DeviceComponentFilterForm):
|
||||
class DeviceBayFilterForm(DeviceComponentFilterForm):
|
||||
model = DeviceBay
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', 'label', name=_('Attributes')),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
@@ -1399,10 +1404,13 @@ class DeviceBayFilterForm(DeviceComponentFilterForm):
|
||||
class InventoryItemFilterForm(DeviceComponentFilterForm):
|
||||
model = InventoryItem
|
||||
fieldsets = (
|
||||
(None, ('q', 'filter_id', 'tag')),
|
||||
(_('Attributes'), ('name', 'label', 'role_id', 'manufacturer_id', 'serial', 'asset_tag', 'discovered')),
|
||||
(_('Location'), ('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id')),
|
||||
(_('Device'), ('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id')),
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet(
|
||||
'name', 'label', 'role_id', 'manufacturer_id', 'serial', 'asset_tag', 'discovered',
|
||||
name=_('Attributes')
|
||||
),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')),
|
||||
FieldSet('device_type_id', 'device_role_id', 'device_id', 'virtual_chassis_id', name=_('Device')),
|
||||
)
|
||||
role_id = DynamicModelMultipleChoiceField(
|
||||
queryset=InventoryItemRole.objects.all(),
|
||||
|
@@ -16,7 +16,7 @@ from utilities.forms.fields import (
|
||||
CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, JSONField,
|
||||
NumericArrayField, SlugField,
|
||||
)
|
||||
from utilities.forms.rendering import InlineFields, TabbedGroups
|
||||
from utilities.forms.rendering import FieldSet, InlineFields, TabbedGroups
|
||||
from utilities.forms.widgets import APISelect, ClearableFileInput, HTMXSelect, NumberWithOptions, SelectWithPK
|
||||
from virtualization.models import Cluster
|
||||
from wireless.models import WirelessLAN, WirelessLANGroup
|
||||
@@ -78,9 +78,7 @@ class RegionForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Region'), (
|
||||
'parent', 'name', 'slug', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('parent', 'name', 'slug', 'description', 'tags'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -99,9 +97,7 @@ class SiteGroupForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Site Group'), (
|
||||
'parent', 'name', 'slug', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('parent', 'name', 'slug', 'description', 'tags'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -136,11 +132,12 @@ class SiteForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Site'), (
|
||||
FieldSet(
|
||||
'name', 'slug', 'status', 'region', 'group', 'facility', 'asns', 'time_zone', 'description', 'tags',
|
||||
)),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
(_('Contact Info'), ('physical_address', 'shipping_address', 'latitude', 'longitude')),
|
||||
name=_('Site')
|
||||
),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
FieldSet('physical_address', 'shipping_address', 'latitude', 'longitude', name=_('Contact Info')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -180,8 +177,8 @@ class LocationForm(TenancyForm, NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Location'), ('site', 'parent', 'name', 'slug', 'status', 'facility', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet('site', 'parent', 'name', 'slug', 'status', 'facility', 'description', 'tags', name=_('Location')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -195,9 +192,7 @@ class RackRoleForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Rack Role'), (
|
||||
'name', 'slug', 'color', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('name', 'slug', 'color', 'description', 'tags', name=_('Rack Role')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -229,19 +224,15 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Rack'), ('site', 'location', 'name', 'status', 'role', 'description', 'tags')),
|
||||
(_('Inventory Control'), ('facility_id', 'serial', 'asset_tag')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
(_('Dimensions'), (
|
||||
'type',
|
||||
'width',
|
||||
'starting_unit',
|
||||
'u_height',
|
||||
FieldSet('site', 'location', 'name', 'status', 'role', 'description', 'tags', name=_('Rack')),
|
||||
FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
FieldSet(
|
||||
'type', 'width', 'starting_unit', 'u_height',
|
||||
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
|
||||
InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')),
|
||||
'mounting_depth',
|
||||
'desc_units',
|
||||
)),
|
||||
'mounting_depth', 'desc_units', name=_('Dimensions')
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -273,8 +264,8 @@ class RackReservationForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Reservation'), ('rack', 'units', 'user', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet('rack', 'units', 'user', 'description', 'tags', name=_('Reservation')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -288,9 +279,7 @@ class ManufacturerForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Manufacturer'), (
|
||||
'name', 'slug', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('name', 'slug', 'description', 'tags', name=_('Manufacturer')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -321,12 +310,12 @@ class DeviceTypeForm(NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Device Type'), ('manufacturer', 'model', 'slug', 'default_platform', 'description', 'tags')),
|
||||
(_('Chassis'), (
|
||||
FieldSet('manufacturer', 'model', 'slug', 'default_platform', 'description', 'tags', name=_('Device Type')),
|
||||
FieldSet(
|
||||
'u_height', 'exclude_from_utilization', 'is_full_depth', 'part_number', 'subdevice_role', 'airflow',
|
||||
'weight', 'weight_unit',
|
||||
)),
|
||||
(_('Images'), ('front_image', 'rear_image')),
|
||||
'weight', 'weight_unit', name=_('Chassis')
|
||||
),
|
||||
FieldSet('front_image', 'rear_image', name=_('Images')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -354,8 +343,8 @@ class ModuleTypeForm(NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Module Type'), ('manufacturer', 'model', 'part_number', 'description', 'tags')),
|
||||
(_('Weight'), ('weight', 'weight_unit'))
|
||||
FieldSet('manufacturer', 'model', 'part_number', 'description', 'tags', name=_('Module Type')),
|
||||
FieldSet('weight', 'weight_unit', name=_('Weight'))
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -374,9 +363,9 @@ class DeviceRoleForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Device Role'), (
|
||||
'name', 'slug', 'color', 'vm_role', 'config_template', 'description', 'tags',
|
||||
)),
|
||||
FieldSet(
|
||||
'name', 'slug', 'color', 'vm_role', 'config_template', 'description', 'tags', name=_('Device Role')
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -403,7 +392,7 @@ class PlatformForm(NetBoxModelForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(_('Platform'), ('name', 'slug', 'manufacturer', 'config_template', 'description', 'tags')),
|
||||
FieldSet('name', 'slug', 'manufacturer', 'config_template', 'description', 'tags', name=_('Platform')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -618,10 +607,8 @@ class ModuleForm(ModuleCommonForm, NetBoxModelForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(_('Module'), ('device', 'module_bay', 'module_type', 'status', 'description', 'tags')),
|
||||
(_('Hardware'), (
|
||||
'serial', 'asset_tag', 'replicate_components', 'adopt_components',
|
||||
)),
|
||||
FieldSet('device', 'module_bay', 'module_type', 'status', 'description', 'tags', name=_('Module')),
|
||||
FieldSet('serial', 'asset_tag', 'replicate_components', 'adopt_components', name=_('Hardware')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -675,7 +662,7 @@ class PowerPanelForm(NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
('Power Panel', ('site', 'location', 'name', 'description', 'tags')),
|
||||
FieldSet('site', 'location', 'name', 'description', 'tags', name=_('Power Panel')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -700,9 +687,12 @@ class PowerFeedForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Power Feed'), ('power_panel', 'rack', 'name', 'status', 'type', 'description', 'mark_connected', 'tags')),
|
||||
(_('Characteristics'), ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
FieldSet(
|
||||
'power_panel', 'rack', 'name', 'status', 'type', 'description', 'mark_connected', 'tags',
|
||||
name=_('Power Feed')
|
||||
),
|
||||
FieldSet('supply', 'voltage', 'amperage', 'phase', 'max_utilization', name=_('Characteristics')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -849,7 +839,7 @@ class ModularComponentTemplateForm(ComponentTemplateForm):
|
||||
|
||||
class ConsolePortTemplateForm(ModularComponentTemplateForm):
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'module_type', 'name', 'label', 'type', 'description')),
|
||||
FieldSet('device_type', 'module_type', 'name', 'label', 'type', 'description'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -861,7 +851,7 @@ class ConsolePortTemplateForm(ModularComponentTemplateForm):
|
||||
|
||||
class ConsoleServerPortTemplateForm(ModularComponentTemplateForm):
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'module_type', 'name', 'label', 'type', 'description')),
|
||||
FieldSet('device_type', 'module_type', 'name', 'label', 'type', 'description'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -873,9 +863,9 @@ class ConsoleServerPortTemplateForm(ModularComponentTemplateForm):
|
||||
|
||||
class PowerPortTemplateForm(ModularComponentTemplateForm):
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device_type', 'module_type', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -896,7 +886,7 @@ class PowerOutletTemplateForm(ModularComponentTemplateForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'module_type', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description')),
|
||||
FieldSet('device_type', 'module_type', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -918,9 +908,11 @@ class InterfaceTemplateForm(ModularComponentTemplateForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'module_type', 'name', 'label', 'type', 'enabled', 'mgmt_only', 'description', 'bridge')),
|
||||
(_('PoE'), ('poe_mode', 'poe_type')),
|
||||
(_('Wireless'), ('rf_role',)),
|
||||
FieldSet(
|
||||
'device_type', 'module_type', 'name', 'label', 'type', 'enabled', 'mgmt_only', 'description', 'bridge',
|
||||
),
|
||||
FieldSet('poe_mode', 'poe_type', name=_('PoE')),
|
||||
FieldSet('rf_role', name=_('Wireless')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -942,10 +934,10 @@ class FrontPortTemplateForm(ModularComponentTemplateForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device_type', 'module_type', 'name', 'label', 'type', 'color', 'rear_port', 'rear_port_position',
|
||||
'description',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -958,7 +950,7 @@ class FrontPortTemplateForm(ModularComponentTemplateForm):
|
||||
|
||||
class RearPortTemplateForm(ModularComponentTemplateForm):
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'module_type', 'name', 'label', 'type', 'color', 'positions', 'description')),
|
||||
FieldSet('device_type', 'module_type', 'name', 'label', 'type', 'color', 'positions', 'description'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -970,7 +962,7 @@ class RearPortTemplateForm(ModularComponentTemplateForm):
|
||||
|
||||
class ModuleBayTemplateForm(ComponentTemplateForm):
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'name', 'label', 'position', 'description')),
|
||||
FieldSet('device_type', 'name', 'label', 'position', 'description'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -982,7 +974,7 @@ class ModuleBayTemplateForm(ComponentTemplateForm):
|
||||
|
||||
class DeviceBayTemplateForm(ComponentTemplateForm):
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'name', 'label', 'description')),
|
||||
FieldSet('device_type', 'name', 'label', 'description'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1023,10 +1015,10 @@ class InventoryItemTemplateForm(ComponentTemplateForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device_type', 'parent', 'name', 'label', 'role', 'manufacturer', 'part_id', 'description',
|
||||
'component_type', 'component_id',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1069,9 +1061,9 @@ class ModularDeviceComponentForm(DeviceComponentForm):
|
||||
|
||||
class ConsolePortForm(ModularDeviceComponentForm):
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'speed', 'mark_connected', 'description', 'tags',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1082,11 +1074,10 @@ class ConsolePortForm(ModularDeviceComponentForm):
|
||||
|
||||
|
||||
class ConsoleServerPortForm(ModularDeviceComponentForm):
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'speed', 'mark_connected', 'description', 'tags',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1097,12 +1088,11 @@ class ConsoleServerPortForm(ModularDeviceComponentForm):
|
||||
|
||||
|
||||
class PowerPortForm(ModularDeviceComponentForm):
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected',
|
||||
'description', 'tags',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1124,10 +1114,10 @@ class PowerOutletForm(ModularDeviceComponentForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'power_port', 'feed_leg', 'mark_connected', 'description',
|
||||
'tags',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1223,15 +1213,18 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(_('Interface'), ('device', 'module', 'name', 'label', 'type', 'speed', 'duplex', 'description', 'tags')),
|
||||
(_('Addressing'), ('vrf', 'mac_address', 'wwn')),
|
||||
(_('Operation'), ('vdcs', 'mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected')),
|
||||
(_('Related Interfaces'), ('parent', 'bridge', 'lag')),
|
||||
(_('PoE'), ('poe_mode', 'poe_type')),
|
||||
(_('802.1Q Switching'), ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')),
|
||||
(_('Wireless'), (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'speed', 'duplex', 'description', 'tags', name=_('Interface')
|
||||
),
|
||||
FieldSet('vrf', 'mac_address', 'wwn', name=_('Addressing')),
|
||||
FieldSet('vdcs', 'mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected', name=_('Operation')),
|
||||
FieldSet('parent', 'bridge', 'lag', name=_('Related Interfaces')),
|
||||
FieldSet('poe_mode', 'poe_type', name=_('PoE')),
|
||||
FieldSet('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', name=_('802.1Q Switching')),
|
||||
FieldSet(
|
||||
'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'wireless_lan_group', 'wireless_lans',
|
||||
)),
|
||||
name=_('Wireless')
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1262,10 +1255,10 @@ class FrontPortForm(ModularDeviceComponentForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'color', 'rear_port', 'rear_port_position', 'mark_connected',
|
||||
'description', 'tags',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1278,9 +1271,9 @@ class FrontPortForm(ModularDeviceComponentForm):
|
||||
|
||||
class RearPortForm(ModularDeviceComponentForm):
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'color', 'positions', 'mark_connected', 'description', 'tags',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1292,7 +1285,7 @@ class RearPortForm(ModularDeviceComponentForm):
|
||||
|
||||
class ModuleBayForm(DeviceComponentForm):
|
||||
fieldsets = (
|
||||
(None, ('device', 'name', 'label', 'position', 'description', 'tags',)),
|
||||
FieldSet('device', 'name', 'label', 'position', 'description', 'tags',),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1304,7 +1297,7 @@ class ModuleBayForm(DeviceComponentForm):
|
||||
|
||||
class DeviceBayForm(DeviceComponentForm):
|
||||
fieldsets = (
|
||||
(None, ('device', 'name', 'label', 'description', 'tags',)),
|
||||
FieldSet('device', 'name', 'label', 'description', 'tags',),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1412,19 +1405,20 @@ class InventoryItemForm(DeviceComponentForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(_('Inventory Item'), ('device', 'parent', 'name', 'label', 'role', 'description', 'tags')),
|
||||
(_('Hardware'), ('manufacturer', 'part_id', 'serial', 'asset_tag')),
|
||||
(_('Component Assignment'), (
|
||||
FieldSet('device', 'parent', 'name', 'label', 'role', 'description', 'tags', name=_('Inventory Item')),
|
||||
FieldSet('manufacturer', 'part_id', 'serial', 'asset_tag', name=_('Hardware')),
|
||||
FieldSet(
|
||||
TabbedGroups(
|
||||
(_('Interface'), 'interface'),
|
||||
(_('Console Port'), 'consoleport'),
|
||||
(_('Console Server Port'), 'consoleserverport'),
|
||||
(_('Front Port'), 'frontport'),
|
||||
(_('Rear Port'), 'rearport'),
|
||||
(_('Power Port'), 'powerport'),
|
||||
(_('Power Outlet'), 'poweroutlet'),
|
||||
FieldSet('interface', name=_('Interface')),
|
||||
FieldSet('consoleport', name=_('Console Port')),
|
||||
FieldSet('consoleserverport', name=_('Console Server Port')),
|
||||
FieldSet('frontport', name=_('Front Port')),
|
||||
FieldSet('rearport', name=_('Rear Port')),
|
||||
FieldSet('powerport', name=_('Power Port')),
|
||||
FieldSet('poweroutlet', name=_('Power Outlet')),
|
||||
),
|
||||
))
|
||||
name=_('Component Assignment')
|
||||
)
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1484,9 +1478,7 @@ class InventoryItemRoleForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Inventory Item Role'), (
|
||||
'name', 'slug', 'color', 'description', 'tags',
|
||||
)),
|
||||
FieldSet('name', 'slug', 'color', 'description', 'tags', name=_('Inventory Item Role')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -1522,8 +1514,11 @@ class VirtualDeviceContextForm(TenancyForm, NetBoxModelForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(_('Virtual Device Context'), ('device', 'name', 'status', 'identifier', 'primary_ip4', 'primary_ip6', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant'))
|
||||
FieldSet(
|
||||
'device', 'name', 'status', 'identifier', 'primary_ip4', 'primary_ip6', 'tags',
|
||||
name=_('Virtual Device Context')
|
||||
),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy'))
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
@@ -4,6 +4,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
from dcim.models import *
|
||||
from netbox.forms import NetBoxModelForm
|
||||
from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableNameField
|
||||
from utilities.forms.rendering import FieldSet
|
||||
from utilities.forms.widgets import APISelect
|
||||
from . import model_forms
|
||||
|
||||
@@ -113,7 +114,7 @@ class FrontPortTemplateCreateForm(ComponentCreateForm, model_forms.FrontPortTemp
|
||||
|
||||
# Override fieldsets from FrontPortTemplateForm to omit rear_port_position
|
||||
fieldsets = (
|
||||
(None, ('device_type', 'module_type', 'name', 'label', 'type', 'color', 'rear_port', 'description')),
|
||||
FieldSet('device_type', 'module_type', 'name', 'label', 'type', 'color', 'rear_port', 'description'),
|
||||
)
|
||||
|
||||
class Meta(model_forms.FrontPortTemplateForm.Meta):
|
||||
@@ -274,9 +275,9 @@ class FrontPortCreateForm(ComponentCreateForm, model_forms.FrontPortForm):
|
||||
|
||||
# Override fieldsets from FrontPortForm to omit rear_port_position
|
||||
fieldsets = (
|
||||
(None, (
|
||||
FieldSet(
|
||||
'device', 'module', 'name', 'label', 'type', 'color', 'rear_port', 'mark_connected', 'description', 'tags',
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
class Meta(model_forms.FrontPortForm.Meta):
|
||||
|
Reference in New Issue
Block a user