13149 add gettext_lazy to forms

This commit is contained in:
Arthur 2023-07-13 16:30:41 +07:00 committed by Jeremy Stretch
parent 230d80a31d
commit ef0f98c2c2
10 changed files with 187 additions and 71 deletions

View File

@ -1,5 +1,5 @@
from django import forms from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from utilities.forms import BootstrapMixin, form_from_model from utilities.forms import BootstrapMixin, form_from_model
from utilities.forms.fields import ExpandableNameField from utilities.forms.fields import ExpandableNameField
@ -12,6 +12,7 @@ __all__ = (
class VirtualMachineBulkAddComponentForm(BootstrapMixin, forms.Form): class VirtualMachineBulkAddComponentForm(BootstrapMixin, forms.Form):
pk = forms.ModelMultipleChoiceField( pk = forms.ModelMultipleChoiceField(
label=_('Pk'),
queryset=VirtualMachine.objects.all(), queryset=VirtualMachine.objects.all(),
widget=forms.MultipleHiddenInput() widget=forms.MultipleHiddenInput()
) )

View File

@ -1,5 +1,5 @@
from django import forms from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.choices import InterfaceModeChoices from dcim.choices import InterfaceModeChoices
from dcim.constants import INTERFACE_MTU_MAX, INTERFACE_MTU_MIN from dcim.constants import INTERFACE_MTU_MAX, INTERFACE_MTU_MIN
@ -25,6 +25,7 @@ __all__ = (
class ClusterTypeBulkEditForm(NetBoxModelBulkEditForm): class ClusterTypeBulkEditForm(NetBoxModelBulkEditForm):
description = forms.CharField( description = forms.CharField(
label=_('Description'),
max_length=200, max_length=200,
required=False required=False
) )
@ -38,6 +39,7 @@ class ClusterTypeBulkEditForm(NetBoxModelBulkEditForm):
class ClusterGroupBulkEditForm(NetBoxModelBulkEditForm): class ClusterGroupBulkEditForm(NetBoxModelBulkEditForm):
description = forms.CharField( description = forms.CharField(
label=_('Description'),
max_length=200, max_length=200,
required=False required=False
) )
@ -51,31 +53,38 @@ class ClusterGroupBulkEditForm(NetBoxModelBulkEditForm):
class ClusterBulkEditForm(NetBoxModelBulkEditForm): class ClusterBulkEditForm(NetBoxModelBulkEditForm):
type = DynamicModelChoiceField( type = DynamicModelChoiceField(
label=_('Type'),
queryset=ClusterType.objects.all(), queryset=ClusterType.objects.all(),
required=False required=False
) )
group = DynamicModelChoiceField( group = DynamicModelChoiceField(
label=_('Group'),
queryset=ClusterGroup.objects.all(), queryset=ClusterGroup.objects.all(),
required=False required=False
) )
status = forms.ChoiceField( status = forms.ChoiceField(
label=_('Status'),
choices=add_blank_choice(ClusterStatusChoices), choices=add_blank_choice(ClusterStatusChoices),
required=False, required=False,
initial='' initial=''
) )
tenant = DynamicModelChoiceField( tenant = DynamicModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False required=False
) )
region = DynamicModelChoiceField( region = DynamicModelChoiceField(
label=_('Region'),
queryset=Region.objects.all(), queryset=Region.objects.all(),
required=False, required=False,
) )
site_group = DynamicModelChoiceField( site_group = DynamicModelChoiceField(
label=_('Site group'),
queryset=SiteGroup.objects.all(), queryset=SiteGroup.objects.all(),
required=False, required=False,
) )
site = DynamicModelChoiceField( site = DynamicModelChoiceField(
label=_('Site'),
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False, required=False,
query_params={ query_params={
@ -84,6 +93,7 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
} }
) )
description = forms.CharField( description = forms.CharField(
label=_('Site'),
max_length=200, max_length=200,
required=False required=False
) )
@ -94,7 +104,7 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
model = Cluster model = Cluster
fieldsets = ( fieldsets = (
(None, ('type', 'group', 'status', 'tenant', 'description')), (None, ('type', 'group', 'status', 'tenant', 'description')),
('Site', ('region', 'site_group', 'site')), (_('Site'), ('region', 'site_group', 'site')),
) )
nullable_fields = ( nullable_fields = (
'group', 'site', 'tenant', 'description', 'comments', 'group', 'site', 'tenant', 'description', 'comments',
@ -103,15 +113,18 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm): class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
status = forms.ChoiceField( status = forms.ChoiceField(
label=_('Status'),
choices=add_blank_choice(VirtualMachineStatusChoices), choices=add_blank_choice(VirtualMachineStatusChoices),
required=False, required=False,
initial='', initial='',
) )
site = DynamicModelChoiceField( site = DynamicModelChoiceField(
label=_('Site'),
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False required=False
) )
cluster = DynamicModelChoiceField( cluster = DynamicModelChoiceField(
label=_('Cluster'),
queryset=Cluster.objects.all(), queryset=Cluster.objects.all(),
required=False, required=False,
query_params={ query_params={
@ -119,6 +132,7 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
} }
) )
device = DynamicModelChoiceField( device = DynamicModelChoiceField(
label=_('Device'),
queryset=Device.objects.all(), queryset=Device.objects.all(),
required=False, required=False,
query_params={ query_params={
@ -126,6 +140,7 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
} }
) )
role = DynamicModelChoiceField( role = DynamicModelChoiceField(
label=_('Role'),
queryset=DeviceRole.objects.filter( queryset=DeviceRole.objects.filter(
vm_role=True vm_role=True
), ),
@ -135,10 +150,12 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
} }
) )
tenant = DynamicModelChoiceField( tenant = DynamicModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False required=False
) )
platform = DynamicModelChoiceField( platform = DynamicModelChoiceField(
label=_('Platform'),
queryset=Platform.objects.all(), queryset=Platform.objects.all(),
required=False required=False
) )
@ -155,6 +172,7 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
label=_('Disk (GB)') label=_('Disk (GB)')
) )
description = forms.CharField( description = forms.CharField(
label=_('Description'),
max_length=200, max_length=200,
required=False required=False
) )
@ -165,7 +183,7 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
model = VirtualMachine model = VirtualMachine
fieldsets = ( fieldsets = (
(None, ('site', 'cluster', 'device', 'status', 'role', 'tenant', 'platform', 'description')), (None, ('site', 'cluster', 'device', 'status', 'role', 'tenant', 'platform', 'description')),
('Resources', ('vcpus', 'memory', 'disk')) (_('Resources'), ('vcpus', 'memory', 'disk'))
) )
nullable_fields = ( nullable_fields = (
'site', 'cluster', 'device', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'description', 'comments', 'site', 'cluster', 'device', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'description', 'comments',
@ -174,20 +192,24 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm): class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm):
virtual_machine = forms.ModelChoiceField( virtual_machine = forms.ModelChoiceField(
label=_('Virtual machine'),
queryset=VirtualMachine.objects.all(), queryset=VirtualMachine.objects.all(),
required=False, required=False,
disabled=True, disabled=True,
widget=forms.HiddenInput() widget=forms.HiddenInput()
) )
parent = DynamicModelChoiceField( parent = DynamicModelChoiceField(
label=_('Parent'),
queryset=VMInterface.objects.all(), queryset=VMInterface.objects.all(),
required=False required=False
) )
bridge = DynamicModelChoiceField( bridge = DynamicModelChoiceField(
label=_('Bridge'),
queryset=VMInterface.objects.all(), queryset=VMInterface.objects.all(),
required=False required=False
) )
enabled = forms.NullBooleanField( enabled = forms.NullBooleanField(
label=_('Enabled'),
required=False, required=False,
widget=BulkEditNullBooleanSelect() widget=BulkEditNullBooleanSelect()
) )
@ -198,10 +220,12 @@ class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm):
label=_('MTU') label=_('MTU')
) )
description = forms.CharField( description = forms.CharField(
label=_('Description'),
max_length=100, max_length=100,
required=False required=False
) )
mode = forms.ChoiceField( mode = forms.ChoiceField(
label=_('Mode'),
choices=add_blank_choice(InterfaceModeChoices), choices=add_blank_choice(InterfaceModeChoices),
required=False required=False
) )
@ -235,8 +259,8 @@ class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm):
model = VMInterface model = VMInterface
fieldsets = ( fieldsets = (
(None, ('mtu', 'enabled', 'vrf', 'description')), (None, ('mtu', 'enabled', 'vrf', 'description')),
('Related Interfaces', ('parent', 'bridge')), (_('Related Interfaces'), ('parent', 'bridge')),
('802.1Q Switching', ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')), (_('802.1Q Switching'), ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')),
) )
nullable_fields = ( nullable_fields = (
'parent', 'bridge', 'mtu', 'vrf', 'description', 'parent', 'bridge', 'mtu', 'vrf', 'description',
@ -286,6 +310,7 @@ class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm):
class VMInterfaceBulkRenameForm(BulkRenameForm): class VMInterfaceBulkRenameForm(BulkRenameForm):
pk = forms.ModelMultipleChoiceField( pk = forms.ModelMultipleChoiceField(
label=_('Pk'),
queryset=VMInterface.objects.all(), queryset=VMInterface.objects.all(),
widget=forms.MultipleHiddenInput() widget=forms.MultipleHiddenInput()
) )

View File

@ -1,4 +1,4 @@
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.choices import InterfaceModeChoices from dcim.choices import InterfaceModeChoices
from dcim.models import Device, DeviceRole, Platform, Site from dcim.models import Device, DeviceRole, Platform, Site
@ -19,7 +19,9 @@ __all__ = (
class ClusterTypeImportForm(NetBoxModelImportForm): class ClusterTypeImportForm(NetBoxModelImportForm):
slug = SlugField() slug = SlugField(
label=_('Slug'),
)
class Meta: class Meta:
model = ClusterType model = ClusterType
@ -27,7 +29,9 @@ class ClusterTypeImportForm(NetBoxModelImportForm):
class ClusterGroupImportForm(NetBoxModelImportForm): class ClusterGroupImportForm(NetBoxModelImportForm):
slug = SlugField() slug = SlugField(
label=_('Slug'),
)
class Meta: class Meta:
model = ClusterGroup model = ClusterGroup
@ -36,27 +40,32 @@ class ClusterGroupImportForm(NetBoxModelImportForm):
class ClusterImportForm(NetBoxModelImportForm): class ClusterImportForm(NetBoxModelImportForm):
type = CSVModelChoiceField( type = CSVModelChoiceField(
label=_('Type'),
queryset=ClusterType.objects.all(), queryset=ClusterType.objects.all(),
to_field_name='name', to_field_name='name',
help_text=_('Type of cluster') help_text=_('Type of cluster')
) )
group = CSVModelChoiceField( group = CSVModelChoiceField(
label=_('Group'),
queryset=ClusterGroup.objects.all(), queryset=ClusterGroup.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text=_('Assigned cluster group') help_text=_('Assigned cluster group')
) )
status = CSVChoiceField( status = CSVChoiceField(
label=_('Status'),
choices=ClusterStatusChoices, choices=ClusterStatusChoices,
help_text=_('Operational status') help_text=_('Operational status')
) )
site = CSVModelChoiceField( site = CSVModelChoiceField(
label=_('Site'),
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text=_('Assigned site') help_text=_('Assigned site')
) )
tenant = CSVModelChoiceField( tenant = CSVModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
@ -70,28 +79,33 @@ class ClusterImportForm(NetBoxModelImportForm):
class VirtualMachineImportForm(NetBoxModelImportForm): class VirtualMachineImportForm(NetBoxModelImportForm):
status = CSVChoiceField( status = CSVChoiceField(
label=_('Status'),
choices=VirtualMachineStatusChoices, choices=VirtualMachineStatusChoices,
help_text=_('Operational status') help_text=_('Operational status')
) )
site = CSVModelChoiceField( site = CSVModelChoiceField(
label=_('Site'),
queryset=Site.objects.all(), queryset=Site.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text=_('Assigned site') help_text=_('Assigned site')
) )
cluster = CSVModelChoiceField( cluster = CSVModelChoiceField(
label=_('Cluster'),
queryset=Cluster.objects.all(), queryset=Cluster.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text=_('Assigned cluster') help_text=_('Assigned cluster')
) )
device = CSVModelChoiceField( device = CSVModelChoiceField(
label=_('Device'),
queryset=Device.objects.all(), queryset=Device.objects.all(),
to_field_name='name', to_field_name='name',
required=False, required=False,
help_text=_('Assigned device within cluster') help_text=_('Assigned device within cluster')
) )
role = CSVModelChoiceField( role = CSVModelChoiceField(
label=_('Role'),
queryset=DeviceRole.objects.filter( queryset=DeviceRole.objects.filter(
vm_role=True vm_role=True
), ),
@ -100,12 +114,14 @@ class VirtualMachineImportForm(NetBoxModelImportForm):
help_text=_('Functional role') help_text=_('Functional role')
) )
tenant = CSVModelChoiceField( tenant = CSVModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Assigned tenant') help_text=_('Assigned tenant')
) )
platform = CSVModelChoiceField( platform = CSVModelChoiceField(
label=_('Platform'),
queryset=Platform.objects.all(), queryset=Platform.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
@ -122,27 +138,32 @@ class VirtualMachineImportForm(NetBoxModelImportForm):
class VMInterfaceImportForm(NetBoxModelImportForm): class VMInterfaceImportForm(NetBoxModelImportForm):
virtual_machine = CSVModelChoiceField( virtual_machine = CSVModelChoiceField(
label=_('Virtual machine'),
queryset=VirtualMachine.objects.all(), queryset=VirtualMachine.objects.all(),
to_field_name='name' to_field_name='name'
) )
parent = CSVModelChoiceField( parent = CSVModelChoiceField(
label=_('Parent'),
queryset=VMInterface.objects.all(), queryset=VMInterface.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Parent interface') help_text=_('Parent interface')
) )
bridge = CSVModelChoiceField( bridge = CSVModelChoiceField(
label=_('Bridge'),
queryset=VMInterface.objects.all(), queryset=VMInterface.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Bridged interface') help_text=_('Bridged interface')
) )
mode = CSVChoiceField( mode = CSVChoiceField(
label=_('Mode'),
choices=InterfaceModeChoices, choices=InterfaceModeChoices,
required=False, required=False,
help_text=_('IEEE 802.1Q operational mode (for L2 interfaces)') help_text=_('IEEE 802.1Q operational mode (for L2 interfaces)')
) )
vrf = CSVModelChoiceField( vrf = CSVModelChoiceField(
label=_('VRF'),
queryset=VRF.objects.all(), queryset=VRF.objects.all(),
required=False, required=False,
to_field_name='rd', to_field_name='rd',

View File

@ -1,5 +1,5 @@
from django import forms from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup
from extras.forms import LocalConfigContextFilterForm from extras.forms import LocalConfigContextFilterForm
@ -30,7 +30,7 @@ class ClusterGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
tag = TagFilterField(model) tag = TagFilterField(model)
fieldsets = ( fieldsets = (
(None, ('q', 'filter_id', 'tag')), (None, ('q', 'filter_id', 'tag')),
('Contacts', ('contact', 'contact_role', 'contact_group')), (_('Contacts'), ('contact', 'contact_role', 'contact_group')),
) )
@ -38,10 +38,10 @@ class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
model = Cluster model = Cluster
fieldsets = ( fieldsets = (
(None, ('q', 'filter_id', 'tag')), (None, ('q', 'filter_id', 'tag')),
('Attributes', ('group_id', 'type_id', 'status')), (_('Attributes'), ('group_id', 'type_id', 'status')),
('Location', ('region_id', 'site_group_id', 'site_id')), (_('Location'), ('region_id', 'site_group_id', 'site_id')),
('Tenant', ('tenant_group_id', 'tenant_id')), (_('Tenant'), ('tenant_group_id', 'tenant_id')),
('Contacts', ('contact', 'contact_role', 'contact_group')), (_('Contacts'), ('contact', 'contact_role', 'contact_group')),
) )
type_id = DynamicModelMultipleChoiceField( type_id = DynamicModelMultipleChoiceField(
queryset=ClusterType.objects.all(), queryset=ClusterType.objects.all(),
@ -54,6 +54,7 @@ class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
label=_('Region') label=_('Region')
) )
status = forms.MultipleChoiceField( status = forms.MultipleChoiceField(
label=_('Status'),
choices=ClusterStatusChoices, choices=ClusterStatusChoices,
required=False required=False
) )
@ -90,11 +91,11 @@ class VirtualMachineFilterForm(
model = VirtualMachine model = VirtualMachine
fieldsets = ( fieldsets = (
(None, ('q', 'filter_id', 'tag')), (None, ('q', 'filter_id', 'tag')),
('Cluster', ('cluster_group_id', 'cluster_type_id', 'cluster_id', 'device_id')), (_('Cluster'), ('cluster_group_id', 'cluster_type_id', 'cluster_id', 'device_id')),
('Location', ('region_id', 'site_group_id', 'site_id')), (_('Location'), ('region_id', 'site_group_id', 'site_id')),
('Attributes', ('status', 'role_id', 'platform_id', 'mac_address', 'has_primary_ip', 'local_context_data')), (_('Attributes'), ('status', 'role_id', 'platform_id', 'mac_address', 'has_primary_ip', 'local_context_data')),
('Tenant', ('tenant_group_id', 'tenant_id')), (_('Tenant'), ('tenant_group_id', 'tenant_id')),
('Contacts', ('contact', 'contact_role', 'contact_group')), (_('Contacts'), ('contact', 'contact_role', 'contact_group')),
) )
cluster_group_id = DynamicModelMultipleChoiceField( cluster_group_id = DynamicModelMultipleChoiceField(
queryset=ClusterGroup.objects.all(), queryset=ClusterGroup.objects.all(),
@ -148,6 +149,7 @@ class VirtualMachineFilterForm(
label=_('Role') label=_('Role')
) )
status = forms.MultipleChoiceField( status = forms.MultipleChoiceField(
label=_('Status'),
choices=VirtualMachineStatusChoices, choices=VirtualMachineStatusChoices,
required=False required=False
) )
@ -175,8 +177,8 @@ class VMInterfaceFilterForm(NetBoxModelFilterSetForm):
model = VMInterface model = VMInterface
fieldsets = ( fieldsets = (
(None, ('q', 'filter_id', 'tag')), (None, ('q', 'filter_id', 'tag')),
('Virtual Machine', ('cluster_id', 'virtual_machine_id')), (_('Virtual Machine'), ('cluster_id', 'virtual_machine_id')),
('Attributes', ('enabled', 'mac_address', 'vrf_id', 'l2vpn_id')), (_('Attributes'), ('enabled', 'mac_address', 'vrf_id', 'l2vpn_id')),
) )
cluster_id = DynamicModelMultipleChoiceField( cluster_id = DynamicModelMultipleChoiceField(
queryset=Cluster.objects.all(), queryset=Cluster.objects.all(),
@ -192,6 +194,7 @@ class VMInterfaceFilterForm(NetBoxModelFilterSetForm):
label=_('Virtual machine') label=_('Virtual machine')
) )
enabled = forms.NullBooleanField( enabled = forms.NullBooleanField(
label=_('Enabled'),
required=False, required=False,
widget=forms.Select( widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES choices=BOOLEAN_WITH_BLANK_CHOICES
@ -199,12 +202,12 @@ class VMInterfaceFilterForm(NetBoxModelFilterSetForm):
) )
mac_address = forms.CharField( mac_address = forms.CharField(
required=False, required=False,
label='MAC address' label=_('MAC address')
) )
vrf_id = DynamicModelMultipleChoiceField( vrf_id = DynamicModelMultipleChoiceField(
queryset=VRF.objects.all(), queryset=VRF.objects.all(),
required=False, required=False,
label='VRF' label=_('VRF')
) )
l2vpn_id = DynamicModelMultipleChoiceField( l2vpn_id = DynamicModelMultipleChoiceField(
queryset=L2VPN.objects.all(), queryset=L2VPN.objects.all(),

View File

@ -1,7 +1,7 @@
from django import forms from django import forms
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.forms.common import InterfaceCommonForm from dcim.forms.common import InterfaceCommonForm
from dcim.models import Device, DeviceRole, Platform, Rack, Region, Site, SiteGroup from dcim.models import Device, DeviceRole, Platform, Rack, Region, Site, SiteGroup
@ -27,10 +27,12 @@ __all__ = (
class ClusterTypeForm(NetBoxModelForm): class ClusterTypeForm(NetBoxModelForm):
slug = SlugField() slug = SlugField(
label=_('Slug'),
)
fieldsets = ( fieldsets = (
('Cluster Type', ( (_('Cluster Type'), (
'name', 'slug', 'description', 'tags', 'name', 'slug', 'description', 'tags',
)), )),
) )
@ -43,10 +45,12 @@ class ClusterTypeForm(NetBoxModelForm):
class ClusterGroupForm(NetBoxModelForm): class ClusterGroupForm(NetBoxModelForm):
slug = SlugField() slug = SlugField(
label=_('Slug'),
)
fieldsets = ( fieldsets = (
('Cluster Group', ( (_('Cluster Group'), (
'name', 'slug', 'description', 'tags', 'name', 'slug', 'description', 'tags',
)), )),
) )
@ -60,22 +64,27 @@ class ClusterGroupForm(NetBoxModelForm):
class ClusterForm(TenancyForm, NetBoxModelForm): class ClusterForm(TenancyForm, NetBoxModelForm):
type = DynamicModelChoiceField( type = DynamicModelChoiceField(
label=_('Type'),
queryset=ClusterType.objects.all() queryset=ClusterType.objects.all()
) )
group = DynamicModelChoiceField( group = DynamicModelChoiceField(
label=_('Group'),
queryset=ClusterGroup.objects.all(), queryset=ClusterGroup.objects.all(),
required=False required=False
) )
site = DynamicModelChoiceField( site = DynamicModelChoiceField(
label=_('Site'),
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False, required=False,
selector=True selector=True
) )
comments = CommentField() comments = CommentField(
label=_('Comments'),
)
fieldsets = ( fieldsets = (
('Cluster', ('name', 'type', 'group', 'site', 'status', 'description', 'tags')), (_('Cluster'), ('name', 'type', 'group', 'site', 'status', 'description', 'tags')),
('Tenancy', ('tenant_group', 'tenant')), (_('Tenancy'), ('tenant_group', 'tenant')),
) )
class Meta: class Meta:
@ -87,16 +96,19 @@ class ClusterForm(TenancyForm, NetBoxModelForm):
class ClusterAddDevicesForm(BootstrapMixin, forms.Form): class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
region = DynamicModelChoiceField( region = DynamicModelChoiceField(
label=_('Region'),
queryset=Region.objects.all(), queryset=Region.objects.all(),
required=False, required=False,
null_option='None' null_option='None'
) )
site_group = DynamicModelChoiceField( site_group = DynamicModelChoiceField(
label=_('Site group'),
queryset=SiteGroup.objects.all(), queryset=SiteGroup.objects.all(),
required=False, required=False,
null_option='None' null_option='None'
) )
site = DynamicModelChoiceField( site = DynamicModelChoiceField(
label=_('Site'),
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False, required=False,
query_params={ query_params={
@ -105,6 +117,7 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
} }
) )
rack = DynamicModelChoiceField( rack = DynamicModelChoiceField(
label=_('Rack'),
queryset=Rack.objects.all(), queryset=Rack.objects.all(),
required=False, required=False,
null_option='None', null_option='None',
@ -113,6 +126,7 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
} }
) )
devices = DynamicModelMultipleChoiceField( devices = DynamicModelMultipleChoiceField(
label=_('Devices'),
queryset=Device.objects.all(), queryset=Device.objects.all(),
query_params={ query_params={
'site_id': '$site', 'site_id': '$site',
@ -142,7 +156,7 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
for device in self.cleaned_data.get('devices', []): for device in self.cleaned_data.get('devices', []):
if device.site != self.cluster.site: if device.site != self.cluster.site:
raise ValidationError({ raise ValidationError({
'devices': "{} belongs to a different site ({}) than the cluster ({})".format( 'devices': _("{} belongs to a different site ({}) than the cluster ({})").format(
device, device.site, self.cluster.site device, device.site, self.cluster.site
) )
}) })
@ -150,6 +164,7 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
class ClusterRemoveDevicesForm(ConfirmationForm): class ClusterRemoveDevicesForm(ConfirmationForm):
pk = forms.ModelMultipleChoiceField( pk = forms.ModelMultipleChoiceField(
label=_('Pk'),
queryset=Device.objects.all(), queryset=Device.objects.all(),
widget=forms.MultipleHiddenInput() widget=forms.MultipleHiddenInput()
) )
@ -157,10 +172,12 @@ class ClusterRemoveDevicesForm(ConfirmationForm):
class VirtualMachineForm(TenancyForm, NetBoxModelForm): class VirtualMachineForm(TenancyForm, NetBoxModelForm):
site = DynamicModelChoiceField( site = DynamicModelChoiceField(
label=_('Site'),
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False required=False
) )
cluster = DynamicModelChoiceField( cluster = DynamicModelChoiceField(
label=_('Cluster'),
queryset=Cluster.objects.all(), queryset=Cluster.objects.all(),
required=False, required=False,
selector=True, selector=True,
@ -169,6 +186,7 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
} }
) )
device = DynamicModelChoiceField( device = DynamicModelChoiceField(
label=_('Device'),
queryset=Device.objects.all(), queryset=Device.objects.all(),
required=False, required=False,
query_params={ query_params={
@ -178,6 +196,7 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
help_text=_("Optionally pin this VM to a specific host device within the cluster") help_text=_("Optionally pin this VM to a specific host device within the cluster")
) )
role = DynamicModelChoiceField( role = DynamicModelChoiceField(
label=_('Role'),
queryset=DeviceRole.objects.all(), queryset=DeviceRole.objects.all(),
required=False, required=False,
query_params={ query_params={
@ -185,6 +204,7 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
} }
) )
platform = DynamicModelChoiceField( platform = DynamicModelChoiceField(
label=_('Platform'),
queryset=Platform.objects.all(), queryset=Platform.objects.all(),
required=False required=False
) )
@ -195,12 +215,12 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
comments = CommentField() comments = CommentField()
fieldsets = ( fieldsets = (
('Virtual Machine', ('name', 'role', 'status', 'description', 'tags')), (_('Virtual Machine'), ('name', 'role', 'status', 'description', 'tags')),
('Site/Cluster', ('site', 'cluster', 'device')), (_('Site/Cluster'), ('site', 'cluster', 'device')),
('Tenancy', ('tenant_group', 'tenant')), (_('Tenancy'), ('tenant_group', 'tenant')),
('Management', ('platform', 'primary_ip4', 'primary_ip6')), (_('Management'), ('platform', 'primary_ip4', 'primary_ip6')),
('Resources', ('vcpus', 'memory', 'disk')), (_('Resources'), ('vcpus', 'memory', 'disk')),
('Config Context', ('local_context_data',)), (_('Config Context'), ('local_context_data',)),
) )
class Meta: class Meta:
@ -253,6 +273,7 @@ class VirtualMachineForm(TenancyForm, NetBoxModelForm):
class VMInterfaceForm(InterfaceCommonForm, NetBoxModelForm): class VMInterfaceForm(InterfaceCommonForm, NetBoxModelForm):
virtual_machine = DynamicModelChoiceField( virtual_machine = DynamicModelChoiceField(
label=_('Virtual machine'),
queryset=VirtualMachine.objects.all(), queryset=VirtualMachine.objects.all(),
selector=True selector=True
) )
@ -302,11 +323,11 @@ class VMInterfaceForm(InterfaceCommonForm, NetBoxModelForm):
) )
fieldsets = ( fieldsets = (
('Interface', ('virtual_machine', 'name', 'description', 'tags')), (_('Interface'), ('virtual_machine', 'name', 'description', 'tags')),
('Addressing', ('vrf', 'mac_address')), (_('Addressing'), ('vrf', 'mac_address')),
('Operation', ('mtu', 'enabled')), (_('Operation'), ('mtu', 'enabled')),
('Related Interfaces', ('parent', 'bridge')), (_('Related Interfaces'), ('parent', 'bridge')),
('802.1Q Switching', ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')), (_('802.1Q Switching'), ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')),
) )
class Meta: class Meta:

View File

@ -1,3 +1,4 @@
from django.utils.translation import gettext_lazy as _
from utilities.forms.fields import ExpandableNameField from utilities.forms.fields import ExpandableNameField
from .model_forms import VMInterfaceForm from .model_forms import VMInterfaceForm
@ -7,7 +8,9 @@ __all__ = (
class VMInterfaceCreateForm(VMInterfaceForm): class VMInterfaceCreateForm(VMInterfaceForm):
name = ExpandableNameField() name = ExpandableNameField(
label=_('Name'),
)
replication_fields = ('name',) replication_fields = ('name',)
class Meta(VMInterfaceForm.Meta): class Meta(VMInterfaceForm.Meta):

View File

@ -1,5 +1,5 @@
from django import forms from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.choices import LinkStatusChoices from dcim.choices import LinkStatusChoices
from ipam.models import VLAN from ipam.models import VLAN
@ -20,10 +20,12 @@ __all__ = (
class WirelessLANGroupBulkEditForm(NetBoxModelBulkEditForm): class WirelessLANGroupBulkEditForm(NetBoxModelBulkEditForm):
parent = DynamicModelChoiceField( parent = DynamicModelChoiceField(
label=_('Parent'),
queryset=WirelessLANGroup.objects.all(), queryset=WirelessLANGroup.objects.all(),
required=False required=False
) )
description = forms.CharField( description = forms.CharField(
label=_('Description'),
max_length=200, max_length=200,
required=False required=False
) )
@ -37,10 +39,12 @@ class WirelessLANGroupBulkEditForm(NetBoxModelBulkEditForm):
class WirelessLANBulkEditForm(NetBoxModelBulkEditForm): class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
status = forms.ChoiceField( status = forms.ChoiceField(
label=_('Status'),
choices=add_blank_choice(WirelessLANStatusChoices), choices=add_blank_choice(WirelessLANStatusChoices),
required=False required=False
) )
group = DynamicModelChoiceField( group = DynamicModelChoiceField(
label=_('Group'),
queryset=WirelessLANGroup.objects.all(), queryset=WirelessLANGroup.objects.all(),
required=False required=False
) )
@ -55,14 +59,17 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
label=_('SSID') label=_('SSID')
) )
tenant = DynamicModelChoiceField( tenant = DynamicModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False required=False
) )
auth_type = forms.ChoiceField( auth_type = forms.ChoiceField(
label=_('Auth type'),
choices=add_blank_choice(WirelessAuthTypeChoices), choices=add_blank_choice(WirelessAuthTypeChoices),
required=False required=False
) )
auth_cipher = forms.ChoiceField( auth_cipher = forms.ChoiceField(
label=_('Auth cipher'),
choices=add_blank_choice(WirelessAuthCipherChoices), choices=add_blank_choice(WirelessAuthCipherChoices),
required=False required=False
) )
@ -71,17 +78,18 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
label=_('Pre-shared key') label=_('Pre-shared key')
) )
description = forms.CharField( description = forms.CharField(
label=_('Description'),
max_length=200, max_length=200,
required=False required=False
) )
comments = CommentField( comments = CommentField(
label='Comments' label=_('Comments')
) )
model = WirelessLAN model = WirelessLAN
fieldsets = ( fieldsets = (
(None, ('group', 'ssid', 'status', 'vlan', 'tenant', 'description')), (None, ('group', 'ssid', 'status', 'vlan', 'tenant', 'description')),
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')), (_('Authentication'), ('auth_type', 'auth_cipher', 'auth_psk')),
) )
nullable_fields = ( nullable_fields = (
'ssid', 'group', 'vlan', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'comments', 'ssid', 'group', 'vlan', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'comments',
@ -95,18 +103,22 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
label=_('SSID') label=_('SSID')
) )
status = forms.ChoiceField( status = forms.ChoiceField(
label=_('Status'),
choices=add_blank_choice(LinkStatusChoices), choices=add_blank_choice(LinkStatusChoices),
required=False required=False
) )
tenant = DynamicModelChoiceField( tenant = DynamicModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False required=False
) )
auth_type = forms.ChoiceField( auth_type = forms.ChoiceField(
label=_('Auth type'),
choices=add_blank_choice(WirelessAuthTypeChoices), choices=add_blank_choice(WirelessAuthTypeChoices),
required=False required=False
) )
auth_cipher = forms.ChoiceField( auth_cipher = forms.ChoiceField(
label=_('Auth cipher'),
choices=add_blank_choice(WirelessAuthCipherChoices), choices=add_blank_choice(WirelessAuthCipherChoices),
required=False required=False
) )
@ -115,17 +127,18 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
label=_('Pre-shared key') label=_('Pre-shared key')
) )
description = forms.CharField( description = forms.CharField(
label=_('Description'),
max_length=200, max_length=200,
required=False required=False
) )
comments = CommentField( comments = CommentField(
label='Comments' label=_('Comments')
) )
model = WirelessLink model = WirelessLink
fieldsets = ( fieldsets = (
(None, ('ssid', 'status', 'tenant', 'description')), (None, ('ssid', 'status', 'tenant', 'description')),
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')) (_('Authentication'), ('auth_type', 'auth_cipher', 'auth_psk'))
) )
nullable_fields = ( nullable_fields = (
'ssid', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'comments', 'ssid', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'comments',

View File

@ -1,4 +1,4 @@
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.choices import LinkStatusChoices from dcim.choices import LinkStatusChoices
from dcim.models import Interface from dcim.models import Interface
@ -18,12 +18,15 @@ __all__ = (
class WirelessLANGroupImportForm(NetBoxModelImportForm): class WirelessLANGroupImportForm(NetBoxModelImportForm):
parent = CSVModelChoiceField( parent = CSVModelChoiceField(
label=_('Parent'),
queryset=WirelessLANGroup.objects.all(), queryset=WirelessLANGroup.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Parent group') help_text=_('Parent group')
) )
slug = SlugField() slug = SlugField(
label=_('Slug'),
)
class Meta: class Meta:
model = WirelessLANGroup model = WirelessLANGroup
@ -32,33 +35,39 @@ class WirelessLANGroupImportForm(NetBoxModelImportForm):
class WirelessLANImportForm(NetBoxModelImportForm): class WirelessLANImportForm(NetBoxModelImportForm):
group = CSVModelChoiceField( group = CSVModelChoiceField(
label=_('Group'),
queryset=WirelessLANGroup.objects.all(), queryset=WirelessLANGroup.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Assigned group') help_text=_('Assigned group')
) )
status = CSVChoiceField( status = CSVChoiceField(
label=_('Status'),
choices=WirelessLANStatusChoices, choices=WirelessLANStatusChoices,
help_text='Operational status' help_text='Operational status'
) )
vlan = CSVModelChoiceField( vlan = CSVModelChoiceField(
label=_('VLAN'),
queryset=VLAN.objects.all(), queryset=VLAN.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Bridged VLAN') help_text=_('Bridged VLAN')
) )
tenant = CSVModelChoiceField( tenant = CSVModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Assigned tenant') help_text=_('Assigned tenant')
) )
auth_type = CSVChoiceField( auth_type = CSVChoiceField(
label=_('Auth type'),
choices=WirelessAuthTypeChoices, choices=WirelessAuthTypeChoices,
required=False, required=False,
help_text=_('Authentication type') help_text=_('Authentication type')
) )
auth_cipher = CSVChoiceField( auth_cipher = CSVChoiceField(
label=_('Auth cipher'),
choices=WirelessAuthCipherChoices, choices=WirelessAuthCipherChoices,
required=False, required=False,
help_text=_('Authentication cipher') help_text=_('Authentication cipher')
@ -74,27 +83,33 @@ class WirelessLANImportForm(NetBoxModelImportForm):
class WirelessLinkImportForm(NetBoxModelImportForm): class WirelessLinkImportForm(NetBoxModelImportForm):
status = CSVChoiceField( status = CSVChoiceField(
label=_('Status'),
choices=LinkStatusChoices, choices=LinkStatusChoices,
help_text=_('Connection status') help_text=_('Connection status')
) )
interface_a = CSVModelChoiceField( interface_a = CSVModelChoiceField(
label=_('Interface a'),
queryset=Interface.objects.all() queryset=Interface.objects.all()
) )
interface_b = CSVModelChoiceField( interface_b = CSVModelChoiceField(
label=_('Interface b'),
queryset=Interface.objects.all() queryset=Interface.objects.all()
) )
tenant = CSVModelChoiceField( tenant = CSVModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(), queryset=Tenant.objects.all(),
required=False, required=False,
to_field_name='name', to_field_name='name',
help_text=_('Assigned tenant') help_text=_('Assigned tenant')
) )
auth_type = CSVChoiceField( auth_type = CSVChoiceField(
label=_('Auth type'),
choices=WirelessAuthTypeChoices, choices=WirelessAuthTypeChoices,
required=False, required=False,
help_text=_('Authentication type') help_text=_('Authentication type')
) )
auth_cipher = CSVChoiceField( auth_cipher = CSVChoiceField(
label=_('Auth cipher'),
choices=WirelessAuthCipherChoices, choices=WirelessAuthCipherChoices,
required=False, required=False,
help_text=_('Authentication cipher') help_text=_('Authentication cipher')

View File

@ -1,5 +1,5 @@
from django import forms from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.choices import LinkStatusChoices from dcim.choices import LinkStatusChoices
from netbox.forms import NetBoxModelFilterSetForm from netbox.forms import NetBoxModelFilterSetForm
@ -30,9 +30,9 @@ class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
model = WirelessLAN model = WirelessLAN
fieldsets = ( fieldsets = (
(None, ('q', 'filter_id', 'tag')), (None, ('q', 'filter_id', 'tag')),
('Attributes', ('ssid', 'group_id', 'status')), (_('Attributes'), ('ssid', 'group_id', 'status')),
('Tenant', ('tenant_group_id', 'tenant_id')), (_('Tenant'), ('tenant_group_id', 'tenant_id')),
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')), (_('Authentication'), ('auth_type', 'auth_cipher', 'auth_psk')),
) )
ssid = forms.CharField( ssid = forms.CharField(
required=False, required=False,
@ -45,18 +45,22 @@ class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
label=_('Group') label=_('Group')
) )
status = forms.ChoiceField( status = forms.ChoiceField(
label=_('Status'),
required=False, required=False,
choices=add_blank_choice(WirelessLANStatusChoices) choices=add_blank_choice(WirelessLANStatusChoices)
) )
auth_type = forms.ChoiceField( auth_type = forms.ChoiceField(
label=_('Auth type'),
required=False, required=False,
choices=add_blank_choice(WirelessAuthTypeChoices) choices=add_blank_choice(WirelessAuthTypeChoices)
) )
auth_cipher = forms.ChoiceField( auth_cipher = forms.ChoiceField(
label=_('Auth cipher'),
required=False, required=False,
choices=add_blank_choice(WirelessAuthCipherChoices) choices=add_blank_choice(WirelessAuthCipherChoices)
) )
auth_psk = forms.CharField( auth_psk = forms.CharField(
label=_('Auth psk'),
required=False required=False
) )
tag = TagFilterField(model) tag = TagFilterField(model)
@ -66,27 +70,31 @@ class WirelessLinkFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
model = WirelessLink model = WirelessLink
fieldsets = ( fieldsets = (
(None, ('q', 'filter_id', 'tag')), (None, ('q', 'filter_id', 'tag')),
('Attributes', ('ssid', 'status',)), (_('Attributes'), ('ssid', 'status',)),
('Tenant', ('tenant_group_id', 'tenant_id')), (_('Tenant'), ('tenant_group_id', 'tenant_id')),
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')), (_('Authentication'), ('auth_type', 'auth_cipher', 'auth_psk')),
) )
ssid = forms.CharField( ssid = forms.CharField(
required=False, required=False,
label=_('SSID') label=_('SSID')
) )
status = forms.ChoiceField( status = forms.ChoiceField(
label=_('Status'),
required=False, required=False,
choices=add_blank_choice(LinkStatusChoices) choices=add_blank_choice(LinkStatusChoices)
) )
auth_type = forms.ChoiceField( auth_type = forms.ChoiceField(
label=_('Auth type'),
required=False, required=False,
choices=add_blank_choice(WirelessAuthTypeChoices) choices=add_blank_choice(WirelessAuthTypeChoices)
) )
auth_cipher = forms.ChoiceField( auth_cipher = forms.ChoiceField(
label=_('Auth cipher'),
required=False, required=False,
choices=add_blank_choice(WirelessAuthCipherChoices) choices=add_blank_choice(WirelessAuthCipherChoices)
) )
auth_psk = forms.CharField( auth_psk = forms.CharField(
label=_('Auth psk'),
required=False required=False
) )
tag = TagFilterField(model) tag = TagFilterField(model)

View File

@ -1,5 +1,5 @@
from django.forms import PasswordInput from django.forms import PasswordInput
from django.utils.translation import gettext as _ from django.utils.translation import gettext_lazy as _
from dcim.models import Device, Interface, Location, Site from dcim.models import Device, Interface, Location, Site
from ipam.models import VLAN from ipam.models import VLAN
@ -17,13 +17,16 @@ __all__ = (
class WirelessLANGroupForm(NetBoxModelForm): class WirelessLANGroupForm(NetBoxModelForm):
parent = DynamicModelChoiceField( parent = DynamicModelChoiceField(
label=_('Parent'),
queryset=WirelessLANGroup.objects.all(), queryset=WirelessLANGroup.objects.all(),
required=False required=False
) )
slug = SlugField() slug = SlugField(
label=_('Slug'),
)
fieldsets = ( fieldsets = (
('Wireless LAN Group', ( (_('Wireless LAN Group'), (
'parent', 'name', 'slug', 'description', 'tags', 'parent', 'name', 'slug', 'description', 'tags',
)), )),
) )
@ -37,6 +40,7 @@ class WirelessLANGroupForm(NetBoxModelForm):
class WirelessLANForm(TenancyForm, NetBoxModelForm): class WirelessLANForm(TenancyForm, NetBoxModelForm):
group = DynamicModelChoiceField( group = DynamicModelChoiceField(
label=_('Group'),
queryset=WirelessLANGroup.objects.all(), queryset=WirelessLANGroup.objects.all(),
required=False required=False
) )
@ -46,12 +50,14 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
selector=True, selector=True,
label=_('VLAN') label=_('VLAN')
) )
comments = CommentField() comments = CommentField(
label=_('Comments'),
)
fieldsets = ( fieldsets = (
('Wireless LAN', ('ssid', 'group', 'vlan', 'status', 'description', 'tags')), (_('Wireless LAN'), ('ssid', 'group', 'vlan', 'status', 'description', 'tags')),
('Tenancy', ('tenant_group', 'tenant')), (_('Tenancy'), ('tenant_group', 'tenant')),
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')), (_('Authentication'), ('auth_type', 'auth_cipher', 'auth_psk')),
) )
class Meta: class Meta:
@ -152,11 +158,11 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
comments = CommentField() comments = CommentField()
fieldsets = ( fieldsets = (
('Side A', ('site_a', 'location_a', 'device_a', 'interface_a')), (_('Side A'), ('site_a', 'location_a', 'device_a', 'interface_a')),
('Side B', ('site_b', 'location_b', 'device_b', 'interface_b')), (_('Side B'), ('site_b', 'location_b', 'device_b', 'interface_b')),
('Link', ('status', 'ssid', 'description', 'tags')), (_('Link'), ('status', 'ssid', 'description', 'tags')),
('Tenancy', ('tenant_group', 'tenant')), (_('Tenancy'), ('tenant_group', 'tenant')),
('Authentication', ('auth_type', 'auth_cipher', 'auth_psk')), (_('Authentication'), ('auth_type', 'auth_cipher', 'auth_psk')),
) )
class Meta: class Meta: