network_inventory/users/tables.py

30 lines
887 B
Python
Raw Normal View History

2020-01-10 00:01:06 +01:00
import django_tables2 as tables
2020-08-03 17:14:54 +02:00
from django_tables2.utils import A
2020-01-10 00:01:06 +01:00
from core.tables import CoreTable
2020-01-10 00:01:06 +01:00
from .models import User
class UsersTable(CoreTable):
2020-01-10 00:01:06 +01:00
id = tables.Column(visible=False)
name = tables.Column('User', linkify=True)
description = tables.Column(
attrs={
'td': {
'class': 'text-truncate',
'style': 'max-width: 150px;'}
}
)
2020-01-10 00:01:06 +01:00
customer = tables.Column('Customer', linkify=True)
ad_groups = tables.ManyToManyColumn()
mail_groups = tables.ManyToManyColumn()
2020-08-03 17:14:54 +02:00
delete = tables.LinkColumn('user_delete',
text='delete',
args=[A('pk')], attrs={
'a': {'class': 'delete material-icons', }
2020-08-03 17:37:08 +02:00
}, orderable=False)
2020-01-10 00:01:06 +01:00
class Meta(CoreTable.Meta):
2020-01-10 00:01:06 +01:00
model = User