mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #13150: Wrap table column headers with gettext()
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
import django_tables2 as tables
|
||||
|
||||
from netbox.tables import columns
|
||||
@@ -47,7 +48,7 @@ class TenantGroupColumn(tables.TemplateColumn):
|
||||
|
||||
def __init__(self, accessor=tables.A('tenant__group'), *args, **kwargs):
|
||||
if 'verbose_name' not in kwargs:
|
||||
kwargs['verbose_name'] = 'Tenant Group'
|
||||
kwargs['verbose_name'] = _('Tenant Group')
|
||||
|
||||
super().__init__(template_code=self.template_code, accessor=accessor, *args, **kwargs)
|
||||
|
||||
@@ -56,12 +57,17 @@ class TenantGroupColumn(tables.TemplateColumn):
|
||||
|
||||
|
||||
class TenancyColumnsMixin(tables.Table):
|
||||
tenant_group = TenantGroupColumn()
|
||||
tenant = TenantColumn()
|
||||
tenant_group = TenantGroupColumn(
|
||||
verbose_name=_('Tenant Group'),
|
||||
)
|
||||
tenant = TenantColumn(
|
||||
verbose_name=_('Tenant'),
|
||||
)
|
||||
|
||||
|
||||
class ContactsColumnMixin(tables.Table):
|
||||
contacts = columns.ManyToManyColumn(
|
||||
verbose_name=_('Contacts'),
|
||||
linkify_item=True,
|
||||
transform=lambda obj: obj.contact.name
|
||||
)
|
||||
|
Reference in New Issue
Block a user