network_inventory/network_inventory/inventory/tables.py

67 lines
1.9 KiB
Python
Raw Normal View History

2019-08-02 13:05:42 +02:00
import django_tables2 as tables
from .models import Net, Device, Backup, DeviceInNet
2019-08-02 13:05:42 +02:00
from django_tables2.utils import A
2019-12-11 17:52:50 +01:00
2019-08-02 13:05:42 +02:00
class CustomersTable(tables.Table):
name = tables.LinkColumn('customer', args=[A('pk')])
nets = tables.LinkColumn('nets', text='Nets', args=[A('pk')])
computers = tables.LinkColumn('computers', text='Computers', args=[A('pk')])
devices = tables.LinkColumn('devices', text='Devices', args=[A('pk')])
2019-09-24 20:30:43 +02:00
backups = tables.LinkColumn('backups', text='Backups', args=[A('pk')])
2019-08-02 13:05:42 +02:00
class Meta:
template_name = 'django_tables2/semantic.html'
class ComputersTable(tables.Table):
name = tables.Column('computer', linkify=True)
2019-08-02 13:05:42 +02:00
description = tables.Column()
serialnumber = tables.Column()
owner = tables.Column()
manufacturer = tables.Column()
location = tables.Column()
user = tables.Column()
installation_date = tables.Column()
os = tables.Column()
class Meta:
template_name = 'django_tables2/semantic.html'
class DevicesTable(tables.Table):
name = tables.Column('device', linkify=True)
2019-08-02 13:05:42 +02:00
class Meta:
template_name = 'django_tables2/semantic.html'
model = Device
class NetsTable(tables.Table):
name = tables.Column('net', linkify=True)
customer = tables.Column('customer', linkify=True)
2019-08-02 13:05:42 +02:00
class Meta:
template_name = 'django_tables2/semantic.html'
model = Net
2019-09-24 20:30:43 +02:00
class BackupsTable(tables.Table):
name = tables.Column('backup', linkify=True)
computer = tables.Column('computer', linkify=True)
target_device = tables.ManyToManyColumn(linkify_item=True)
2019-09-24 20:30:43 +02:00
class Meta:
template_name = 'django_tables2/semantic.html'
model = Backup
2019-08-02 13:05:42 +02:00
class NetDetailTable(tables.Table):
device = tables.Column('computer', linkify=True)
ip = tables.Column()
net = tables.Column(visible=False)
2019-08-02 13:05:42 +02:00
class Meta:
template_name = 'django_tables2/semantic.html'
model = DeviceInNet