mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
10300 initial translation support use gettext
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django import forms
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from dcim.choices import LinkStatusChoices
|
||||
from ipam.models import VLAN
|
||||
@@ -45,12 +46,12 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
|
||||
vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
required=False,
|
||||
label='VLAN'
|
||||
label=_('VLAN')
|
||||
)
|
||||
ssid = forms.CharField(
|
||||
max_length=SSID_MAX_LENGTH,
|
||||
required=False,
|
||||
label='SSID'
|
||||
label=_('SSID')
|
||||
)
|
||||
tenant = DynamicModelChoiceField(
|
||||
queryset=Tenant.objects.all(),
|
||||
@@ -66,7 +67,7 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
auth_psk = forms.CharField(
|
||||
required=False,
|
||||
label='Pre-shared key'
|
||||
label=_('Pre-shared key')
|
||||
)
|
||||
description = forms.CharField(
|
||||
max_length=200,
|
||||
@@ -91,7 +92,7 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
|
||||
ssid = forms.CharField(
|
||||
max_length=SSID_MAX_LENGTH,
|
||||
required=False,
|
||||
label='SSID'
|
||||
label=_('SSID')
|
||||
)
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(LinkStatusChoices),
|
||||
@@ -111,7 +112,7 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
auth_psk = forms.CharField(
|
||||
required=False,
|
||||
label='Pre-shared key'
|
||||
label=_('Pre-shared key')
|
||||
)
|
||||
description = forms.CharField(
|
||||
max_length=200,
|
||||
|
@@ -1,3 +1,4 @@
|
||||
from django.utils.translation import gettext as _
|
||||
from dcim.choices import LinkStatusChoices
|
||||
from dcim.models import Interface
|
||||
from ipam.models import VLAN
|
||||
@@ -19,7 +20,7 @@ class WirelessLANGroupCSVForm(NetBoxModelCSVForm):
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text='Parent group'
|
||||
help_text=_('Parent group')
|
||||
)
|
||||
slug = SlugField()
|
||||
|
||||
@@ -33,7 +34,7 @@ class WirelessLANCSVForm(NetBoxModelCSVForm):
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text='Assigned group'
|
||||
help_text=_('Assigned group')
|
||||
)
|
||||
status = CSVChoiceField(
|
||||
choices=WirelessLANStatusChoices,
|
||||
@@ -43,23 +44,23 @@ class WirelessLANCSVForm(NetBoxModelCSVForm):
|
||||
queryset=VLAN.objects.all(),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text='Bridged VLAN'
|
||||
help_text=_('Bridged VLAN')
|
||||
)
|
||||
tenant = CSVModelChoiceField(
|
||||
queryset=Tenant.objects.all(),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text='Assigned tenant'
|
||||
help_text=_('Assigned tenant')
|
||||
)
|
||||
auth_type = CSVChoiceField(
|
||||
choices=WirelessAuthTypeChoices,
|
||||
required=False,
|
||||
help_text='Authentication type'
|
||||
help_text=_('Authentication type')
|
||||
)
|
||||
auth_cipher = CSVChoiceField(
|
||||
choices=WirelessAuthCipherChoices,
|
||||
required=False,
|
||||
help_text='Authentication cipher'
|
||||
help_text=_('Authentication cipher')
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@@ -73,7 +74,7 @@ class WirelessLANCSVForm(NetBoxModelCSVForm):
|
||||
class WirelessLinkCSVForm(NetBoxModelCSVForm):
|
||||
status = CSVChoiceField(
|
||||
choices=LinkStatusChoices,
|
||||
help_text='Connection status'
|
||||
help_text=_('Connection status')
|
||||
)
|
||||
interface_a = CSVModelChoiceField(
|
||||
queryset=Interface.objects.all()
|
||||
@@ -85,17 +86,17 @@ class WirelessLinkCSVForm(NetBoxModelCSVForm):
|
||||
queryset=Tenant.objects.all(),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text='Assigned tenant'
|
||||
help_text=_('Assigned tenant')
|
||||
)
|
||||
auth_type = CSVChoiceField(
|
||||
choices=WirelessAuthTypeChoices,
|
||||
required=False,
|
||||
help_text='Authentication type'
|
||||
help_text=_('Authentication type')
|
||||
)
|
||||
auth_cipher = CSVChoiceField(
|
||||
choices=WirelessAuthCipherChoices,
|
||||
required=False,
|
||||
help_text='Authentication cipher'
|
||||
help_text=_('Authentication cipher')
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
@@ -35,7 +35,7 @@ class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
)
|
||||
ssid = forms.CharField(
|
||||
required=False,
|
||||
label='SSID'
|
||||
label=_('SSID')
|
||||
)
|
||||
group_id = DynamicModelMultipleChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
@@ -74,7 +74,7 @@ class WirelessLinkFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
)
|
||||
ssid = forms.CharField(
|
||||
required=False,
|
||||
label='SSID'
|
||||
label=_('SSID')
|
||||
)
|
||||
status = forms.ChoiceField(
|
||||
required=False,
|
||||
|
@@ -1,3 +1,4 @@
|
||||
from django.utils.translation import gettext as _
|
||||
from dcim.models import Device, Interface, Location, Region, Site, SiteGroup
|
||||
from ipam.models import VLAN, VLANGroup
|
||||
from netbox.forms import NetBoxModelForm
|
||||
@@ -63,7 +64,7 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
|
||||
vlan_group = DynamicModelChoiceField(
|
||||
queryset=VLANGroup.objects.all(),
|
||||
required=False,
|
||||
label='VLAN group',
|
||||
label=_('VLAN group'),
|
||||
null_option='None',
|
||||
query_params={
|
||||
'site': '$site'
|
||||
@@ -75,7 +76,7 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
|
||||
vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
required=False,
|
||||
label='VLAN',
|
||||
label=_('VLAN'),
|
||||
query_params={
|
||||
'site_id': '$site',
|
||||
'group_id': '$vlan_group',
|
||||
@@ -107,7 +108,7 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
|
||||
site_a = DynamicModelChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
required=False,
|
||||
label='Site',
|
||||
label=_('Site'),
|
||||
initial_params={
|
||||
'devices': '$device_a',
|
||||
}
|
||||
@@ -118,7 +119,7 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
|
||||
'site_id': '$site_a',
|
||||
},
|
||||
required=False,
|
||||
label='Location',
|
||||
label=_('Location'),
|
||||
initial_params={
|
||||
'devices': '$device_a',
|
||||
}
|
||||
@@ -130,7 +131,7 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
|
||||
'location_id': '$location_a',
|
||||
},
|
||||
required=False,
|
||||
label='Device',
|
||||
label=_('Device'),
|
||||
initial_params={
|
||||
'interfaces': '$interface_a'
|
||||
}
|
||||
@@ -142,12 +143,12 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
|
||||
'device_id': '$device_a',
|
||||
},
|
||||
disabled_indicator='_occupied',
|
||||
label='Interface'
|
||||
label=_('Interface')
|
||||
)
|
||||
site_b = DynamicModelChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
required=False,
|
||||
label='Site',
|
||||
label=_('Site'),
|
||||
initial_params={
|
||||
'devices': '$device_b',
|
||||
}
|
||||
@@ -158,7 +159,7 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
|
||||
'site_id': '$site_b',
|
||||
},
|
||||
required=False,
|
||||
label='Location',
|
||||
label=_('Location'),
|
||||
initial_params={
|
||||
'devices': '$device_b',
|
||||
}
|
||||
@@ -170,7 +171,7 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
|
||||
'location_id': '$location_b',
|
||||
},
|
||||
required=False,
|
||||
label='Device',
|
||||
label=_('Device'),
|
||||
initial_params={
|
||||
'interfaces': '$interface_b'
|
||||
}
|
||||
@@ -182,7 +183,7 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
|
||||
'device_id': '$device_b',
|
||||
},
|
||||
disabled_indicator='_occupied',
|
||||
label='Interface'
|
||||
label=_('Interface')
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
|
Reference in New Issue
Block a user