mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 16:06:43 -06:00
Tweak variable names; misc string cleanup
This commit is contained in:
parent
701870d919
commit
68f54ddc09
@ -154,12 +154,12 @@ class CircuitFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilte
|
|||||||
provider_account_id = django_filters.ModelMultipleChoiceFilter(
|
provider_account_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
field_name='provider_account',
|
field_name='provider_account',
|
||||||
queryset=ProviderAccount.objects.all(),
|
queryset=ProviderAccount.objects.all(),
|
||||||
label=_('ProviderAccount (ID)'),
|
label=_('Provider account (ID)'),
|
||||||
)
|
)
|
||||||
provider_network_id = django_filters.ModelMultipleChoiceFilter(
|
provider_network_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
field_name='terminations__provider_network',
|
field_name='terminations__provider_network',
|
||||||
queryset=ProviderNetwork.objects.all(),
|
queryset=ProviderNetwork.objects.all(),
|
||||||
label=_('ProviderNetwork (ID)'),
|
label=_('Provider network (ID)'),
|
||||||
)
|
)
|
||||||
type_id = django_filters.ModelMultipleChoiceFilter(
|
type_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
queryset=CircuitType.objects.all(),
|
queryset=CircuitType.objects.all(),
|
||||||
|
@ -88,7 +88,7 @@ class ProviderNetworkFilterForm(NetBoxModelFilterSetForm):
|
|||||||
label=_('Provider')
|
label=_('Provider')
|
||||||
)
|
)
|
||||||
service_id = forms.CharField(
|
service_id = forms.CharField(
|
||||||
label=_('Service id'),
|
label=_('Service ID'),
|
||||||
max_length=100,
|
max_length=100,
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
@ -116,8 +116,8 @@ class ModuleCommonForm(forms.Form):
|
|||||||
# It is not possible to adopt components already belonging to a module
|
# It is not possible to adopt components already belonging to a module
|
||||||
if adopt_components and existing_item and existing_item.module:
|
if adopt_components and existing_item and existing_item.module:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_("Cannot adopt {name} '{resolved_name}' as it already belongs to a module").format(
|
_("Cannot adopt {model} {resolved_name} as it already belongs to a module").format(
|
||||||
name=template.component_model.__name__,
|
model=template.component_model.__name__,
|
||||||
resolved_name=resolved_name
|
resolved_name=resolved_name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -125,8 +125,8 @@ class ModuleCommonForm(forms.Form):
|
|||||||
# If we are not adopting components we error if the component exists
|
# If we are not adopting components we error if the component exists
|
||||||
if not adopt_components and resolved_name in installed_components:
|
if not adopt_components and resolved_name in installed_components:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_("{name} - {resolved_name} already exists").format(
|
_("A {model} named {resolved_name} already exists").format(
|
||||||
name=template.component_model.__name__,
|
model=template.component_model.__name__,
|
||||||
resolved_name=resolved_name
|
resolved_name=resolved_name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -925,7 +925,7 @@ class Device(
|
|||||||
if self.primary_ip4:
|
if self.primary_ip4:
|
||||||
if self.primary_ip4.family != 4:
|
if self.primary_ip4.family != 4:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'primary_ip4': _("{primary_ip4} is not an IPv4 address.").format(primary_ip4=self.primary_ip4)
|
'primary_ip4': _("{ip} is not an IPv4 address.").format(ip=self.primary_ip4)
|
||||||
})
|
})
|
||||||
if self.primary_ip4.assigned_object in vc_interfaces:
|
if self.primary_ip4.assigned_object in vc_interfaces:
|
||||||
pass
|
pass
|
||||||
@ -934,13 +934,13 @@ class Device(
|
|||||||
else:
|
else:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'primary_ip4': _(
|
'primary_ip4': _(
|
||||||
"The specified IP address ({primary_ip4}) is not assigned to this device."
|
"The specified IP address ({ip}) is not assigned to this device."
|
||||||
).format(primary_ip4=self.primary_ip4)
|
).format(ip=self.primary_ip4)
|
||||||
})
|
})
|
||||||
if self.primary_ip6:
|
if self.primary_ip6:
|
||||||
if self.primary_ip6.family != 6:
|
if self.primary_ip6.family != 6:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'primary_ip6': _("{primary_ip6} is not an IPv6 address.").format(primary_ip6=self.primary_ip6m)
|
'primary_ip6': _("{ip} is not an IPv6 address.").format(ip=self.primary_ip6)
|
||||||
})
|
})
|
||||||
if self.primary_ip6.assigned_object in vc_interfaces:
|
if self.primary_ip6.assigned_object in vc_interfaces:
|
||||||
pass
|
pass
|
||||||
@ -949,8 +949,8 @@ class Device(
|
|||||||
else:
|
else:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'primary_ip6': _(
|
'primary_ip6': _(
|
||||||
"The specified IP address ({primary_ip6}) is not assigned to this device."
|
"The specified IP address ({ip}) is not assigned to this device."
|
||||||
).format(primary_ip6=self.primary_ip6)
|
).format(ip=self.primary_ip6)
|
||||||
})
|
})
|
||||||
if self.oob_ip:
|
if self.oob_ip:
|
||||||
if self.oob_ip.assigned_object in vc_interfaces:
|
if self.oob_ip.assigned_object in vc_interfaces:
|
||||||
@ -968,17 +968,19 @@ class Device(
|
|||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'platform': _(
|
'platform': _(
|
||||||
"The assigned platform is limited to {platform_manufacturer} device types, but this device's "
|
"The assigned platform is limited to {platform_manufacturer} device types, but this device's "
|
||||||
"type belongs to {device_type_manufacturer}."
|
"type belongs to {devicetype_manufacturer}."
|
||||||
).format(
|
).format(
|
||||||
platform_manufacturer=self.platform.manufacturer,
|
platform_manufacturer=self.platform.manufacturer,
|
||||||
device_type_manufacturer=self.device_type.manufacturer
|
devicetype_manufacturer=self.device_type.manufacturer
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
# A Device can only be assigned to a Cluster in the same Site (or no Site)
|
# A Device can only be assigned to a Cluster in the same Site (or no Site)
|
||||||
if self.cluster and self.cluster.site is not None and self.cluster.site != self.site:
|
if self.cluster and self.cluster.site is not None and self.cluster.site != self.site:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'cluster': _("The assigned cluster belongs to a different site ({})").format(self.cluster.site)
|
'cluster': _("The assigned cluster belongs to a different site ({site})").format(
|
||||||
|
site=self.cluster.site
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
# Validate virtual chassis assignment
|
# Validate virtual chassis assignment
|
||||||
@ -1450,8 +1452,8 @@ class VirtualDeviceContext(PrimaryModel):
|
|||||||
if primary_ip.family != family:
|
if primary_ip.family != family:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
f'primary_ip{family}': _(
|
f'primary_ip{family}': _(
|
||||||
"{primary_ip} is not an IPv{family} address."
|
"{ip} is not an IPv{family} address."
|
||||||
).format(family=family, primary_ip=primary_ip)
|
).format(family=family, ip=primary_ip)
|
||||||
})
|
})
|
||||||
device_interfaces = self.device.vc_interfaces(if_master=False)
|
device_interfaces = self.device.vc_interfaces(if_master=False)
|
||||||
if primary_ip.assigned_object not in device_interfaces:
|
if primary_ip.assigned_object not in device_interfaces:
|
||||||
|
@ -287,8 +287,8 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'default': _(
|
'default': _(
|
||||||
'Invalid default value "{default}": {message}'
|
'Invalid default value "{value}": {message}'
|
||||||
).format(default=self.default, message=err.message)
|
).format(value=self.default, message=err.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
# Minimum/maximum values can be set only for numeric fields
|
# Minimum/maximum values can be set only for numeric fields
|
||||||
@ -332,8 +332,8 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
elif self.object_type:
|
elif self.object_type:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'object_type': _(
|
'object_type': _(
|
||||||
"{type_display} fields may not define an object type.")
|
"{type} fields may not define an object type.")
|
||||||
.format(type_display=self.get_type_display())
|
.format(type=self.get_type_display())
|
||||||
})
|
})
|
||||||
|
|
||||||
def serialize(self, value):
|
def serialize(self, value):
|
||||||
|
@ -372,14 +372,14 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
|
|||||||
# Do not allow assigning a network ID or broadcast address to an interface.
|
# Do not allow assigning a network ID or broadcast address to an interface.
|
||||||
if interface and (address := self.cleaned_data.get('address')):
|
if interface and (address := self.cleaned_data.get('address')):
|
||||||
if address.ip == address.network:
|
if address.ip == address.network:
|
||||||
msg = _("{address} is a network ID, which may not be assigned to an interface.").format(address=address)
|
msg = _("{ip} is a network ID, which may not be assigned to an interface.").format(ip=address.ip)
|
||||||
if address.version == 4 and address.prefixlen not in (31, 32):
|
if address.version == 4 and address.prefixlen not in (31, 32):
|
||||||
raise ValidationError(msg)
|
raise ValidationError(msg)
|
||||||
if address.version == 6 and address.prefixlen not in (127, 128):
|
if address.version == 6 and address.prefixlen not in (127, 128):
|
||||||
raise ValidationError(msg)
|
raise ValidationError(msg)
|
||||||
if address.version == 4 and address.ip == address.broadcast and address.prefixlen not in (31, 32):
|
if address.version == 4 and address.ip == address.broadcast and address.prefixlen not in (31, 32):
|
||||||
msg = _("{address} is a broadcast address, which may not be assigned to an interface.").format(
|
msg = _("{ip} is a broadcast address, which may not be assigned to an interface.").format(
|
||||||
address=address
|
ip=address.ip
|
||||||
)
|
)
|
||||||
raise ValidationError(msg)
|
raise ValidationError(msg)
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ class IPAddress(PrimaryModel):
|
|||||||
self.role not in IPADDRESS_ROLES_NONUNIQUE or
|
self.role not in IPADDRESS_ROLES_NONUNIQUE or
|
||||||
any(dip.role not in IPADDRESS_ROLES_NONUNIQUE for dip in duplicate_ips)
|
any(dip.role not in IPADDRESS_ROLES_NONUNIQUE for dip in duplicate_ips)
|
||||||
):
|
):
|
||||||
table = _("VRF {}").format(self.vrf) if self.vrf else _("global table")
|
table = _("VRF {vrf}").format(vrf=self.vrf) if self.vrf else _("global table")
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'address': _("Duplicate IP address found in {table}: {ipaddress}").format(
|
'address': _("Duplicate IP address found in {table}: {ipaddress}").format(
|
||||||
table=table,
|
table=table,
|
||||||
|
@ -234,8 +234,8 @@ class VLAN(PrimaryModel):
|
|||||||
if self.group and not self.group.min_vid <= self.vid <= self.group.max_vid:
|
if self.group and not self.group.min_vid <= self.vid <= self.group.max_vid:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'vid': _(
|
'vid': _(
|
||||||
"VID must be between {min_vid} and {max_vid} for VLANs in group {group}"
|
"VID must be between {minimum} and {maximum} for VLANs in group {group}"
|
||||||
).format(min_vid=self.group.min_vid, max_vid=self.group.max_vid, group=self.group)
|
).format(minimum=self.group.min_vid, maximum=self.group.max_vid, group=self.group)
|
||||||
})
|
})
|
||||||
|
|
||||||
def get_status_color(self):
|
def get_status_color(self):
|
||||||
|
12332
netbox/translations/en/LC_MESSAGES/django.po
Normal file
12332
netbox/translations/en/LC_MESSAGES/django.po
Normal file
File diff suppressed because it is too large
Load Diff
12373
netbox/translations/es/LC_MESSAGES/django.po
Normal file
12373
netbox/translations/es/LC_MESSAGES/django.po
Normal file
File diff suppressed because it is too large
Load Diff
@ -386,5 +386,5 @@ class ObjectPermissionForm(BootstrapMixin, forms.ModelForm):
|
|||||||
model.objects.filter(qs_filter_from_constraints(constraints, tokens)).exists()
|
model.objects.filter(qs_filter_from_constraints(constraints, tokens)).exists()
|
||||||
except FieldError as e:
|
except FieldError as e:
|
||||||
raise forms.ValidationError({
|
raise forms.ValidationError({
|
||||||
'constraints': _('Invalid filter for {model}: {e}').format(model=model, e=e)
|
'constraints': _('Invalid filter for {model}: {error}').format(model=model, error=e)
|
||||||
})
|
})
|
||||||
|
@ -169,7 +169,7 @@ class UserConfig(models.Model):
|
|||||||
elif key in d:
|
elif key in d:
|
||||||
err_path = '.'.join(path.split('.')[:i + 1])
|
err_path = '.'.join(path.split('.')[:i + 1])
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
_("Key '{err_path}' is a leaf node; cannot assign new keys").format(err_path=err_path)
|
_("Key '{path}' is a leaf node; cannot assign new keys").format(path=err_path)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
d = d.setdefault(key, {})
|
d = d.setdefault(key, {})
|
||||||
|
@ -213,14 +213,14 @@ class WirelessLink(WirelessAuthenticationBase, PrimaryModel):
|
|||||||
if self.interface_a.type not in WIRELESS_IFACE_TYPES:
|
if self.interface_a.type not in WIRELESS_IFACE_TYPES:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'interface_a': _(
|
'interface_a': _(
|
||||||
"{type_display} is not a wireless interface."
|
"{type} is not a wireless interface."
|
||||||
).format(type_display=self.interface_a.get_type_display())
|
).format(type=self.interface_a.get_type_display())
|
||||||
})
|
})
|
||||||
if self.interface_b.type not in WIRELESS_IFACE_TYPES:
|
if self.interface_b.type not in WIRELESS_IFACE_TYPES:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'interface_a': _(
|
'interface_a': _(
|
||||||
"{type_display} is not a wireless interface."
|
"{type} is not a wireless interface."
|
||||||
).format(type_display=self.interface_b.get_type_display())
|
).format(type=self.interface_b.get_type_display())
|
||||||
})
|
})
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user