1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #13132: Wrap verbose_name and other model text with gettext_lazy() (i18n)

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Arthur Hanson
2023-07-31 22:28:07 +07:00
committed by GitHub
parent 80376abedf
commit 83bebc1bd2
36 changed files with 899 additions and 431 deletions

View File

@@ -3,6 +3,7 @@ from django.contrib.contenttypes.models import ContentType
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from netbox.models import ChangeLoggedModel, PrimaryModel
from ipam.choices import *
@@ -19,13 +20,15 @@ class FHRPGroup(PrimaryModel):
A grouping of next hope resolution protocol (FHRP) peers. (For instance, VRRP or HSRP.)
"""
group_id = models.PositiveSmallIntegerField(
verbose_name='Group ID'
verbose_name=_('group ID')
)
name = models.CharField(
verbose_name=_('name'),
max_length=100,
blank=True
)
protocol = models.CharField(
verbose_name=_('protocol'),
max_length=50,
choices=FHRPGroupProtocolChoices
)
@@ -33,12 +36,12 @@ class FHRPGroup(PrimaryModel):
max_length=50,
choices=FHRPGroupAuthTypeChoices,
blank=True,
verbose_name='Authentication type'
verbose_name=_('authentication type')
)
auth_key = models.CharField(
max_length=255,
blank=True,
verbose_name='Authentication key'
verbose_name=_('authentication key')
)
ip_addresses = GenericRelation(
to='ipam.IPAddress',
@@ -87,6 +90,7 @@ class FHRPGroupAssignment(ChangeLoggedModel):
on_delete=models.CASCADE
)
priority = models.PositiveSmallIntegerField(
verbose_name=_('priority'),
validators=(
MinValueValidator(FHRPGROUPASSIGNMENT_PRIORITY_MIN),
MaxValueValidator(FHRPGROUPASSIGNMENT_PRIORITY_MAX)
@@ -103,7 +107,7 @@ class FHRPGroupAssignment(ChangeLoggedModel):
name='%(app_label)s_%(class)s_unique_interface_group'
),
)
verbose_name = 'FHRP group assignment'
verbose_name = _('FHRP group assignment')
def __str__(self):
return f'{self.interface}: {self.group} ({self.priority})'