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:
@@ -2,6 +2,7 @@ from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from netbox.models import ChangeLoggedModel, NestedGroupModel, OrganizationalModel, PrimaryModel
|
||||
from tenancy.choices import *
|
||||
@@ -51,24 +52,30 @@ class Contact(PrimaryModel):
|
||||
null=True
|
||||
)
|
||||
name = models.CharField(
|
||||
verbose_name=_('name'),
|
||||
max_length=100
|
||||
)
|
||||
title = models.CharField(
|
||||
verbose_name=_('title'),
|
||||
max_length=100,
|
||||
blank=True
|
||||
)
|
||||
phone = models.CharField(
|
||||
verbose_name=_('phone'),
|
||||
max_length=50,
|
||||
blank=True
|
||||
)
|
||||
email = models.EmailField(
|
||||
verbose_name=_('email'),
|
||||
blank=True
|
||||
)
|
||||
address = models.CharField(
|
||||
verbose_name=_('address'),
|
||||
max_length=200,
|
||||
blank=True
|
||||
)
|
||||
link = models.URLField(
|
||||
verbose_name=_('link'),
|
||||
blank=True
|
||||
)
|
||||
|
||||
@@ -113,6 +120,7 @@ class ContactAssignment(ChangeLoggedModel):
|
||||
related_name='assignments'
|
||||
)
|
||||
priority = models.CharField(
|
||||
verbose_name=_('priority'),
|
||||
max_length=50,
|
||||
choices=ContactPriorityChoices,
|
||||
blank=True
|
||||
|
@@ -2,6 +2,7 @@ from django.contrib.contenttypes.fields import GenericRelation
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from netbox.models import NestedGroupModel, PrimaryModel
|
||||
|
||||
@@ -16,10 +17,12 @@ class TenantGroup(NestedGroupModel):
|
||||
An arbitrary collection of Tenants.
|
||||
"""
|
||||
name = models.CharField(
|
||||
verbose_name=_('name'),
|
||||
max_length=100,
|
||||
unique=True
|
||||
)
|
||||
slug = models.SlugField(
|
||||
verbose_name=_('slug'),
|
||||
max_length=100,
|
||||
unique=True
|
||||
)
|
||||
@@ -37,9 +40,11 @@ class Tenant(PrimaryModel):
|
||||
department.
|
||||
"""
|
||||
name = models.CharField(
|
||||
verbose_name=_('name'),
|
||||
max_length=100
|
||||
)
|
||||
slug = models.SlugField(
|
||||
verbose_name=_('slug'),
|
||||
max_length=100
|
||||
)
|
||||
group = models.ForeignKey(
|
||||
@@ -65,7 +70,7 @@ class Tenant(PrimaryModel):
|
||||
models.UniqueConstraint(
|
||||
fields=('group', 'name'),
|
||||
name='%(app_label)s_%(class)s_unique_group_name',
|
||||
violation_error_message="Tenant name must be unique per group."
|
||||
violation_error_message=_("Tenant name must be unique per group.")
|
||||
),
|
||||
models.UniqueConstraint(
|
||||
fields=('name',),
|
||||
@@ -75,7 +80,7 @@ class Tenant(PrimaryModel):
|
||||
models.UniqueConstraint(
|
||||
fields=('group', 'slug'),
|
||||
name='%(app_label)s_%(class)s_unique_group_slug',
|
||||
violation_error_message="Tenant slug must be unique per group."
|
||||
violation_error_message=_("Tenant slug must be unique per group.")
|
||||
),
|
||||
models.UniqueConstraint(
|
||||
fields=('slug',),
|
||||
|
Reference in New Issue
Block a user