mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Introduce LinkedCountColumn to standardize approach to counting related items in tables
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import django_tables2 as tables
|
||||
|
||||
from utilities.tables import BaseTable, ButtonsColumn, TagColumn, ToggleColumn
|
||||
from utilities.tables import BaseTable, ButtonsColumn, LinkedCountColumn, TagColumn, ToggleColumn
|
||||
from .models import Tenant, TenantGroup
|
||||
|
||||
MPTT_LINK = """
|
||||
@ -32,7 +32,9 @@ class TenantGroupTable(BaseTable):
|
||||
template_code=MPTT_LINK,
|
||||
orderable=False
|
||||
)
|
||||
tenant_count = tables.Column(
|
||||
tenant_count = LinkedCountColumn(
|
||||
viewname='tenancy:tenant_list',
|
||||
url_params={'group': 'slug'},
|
||||
verbose_name='Tenants'
|
||||
)
|
||||
actions = ButtonsColumn(TenantGroup, pk_field='slug')
|
||||
|
Reference in New Issue
Block a user