network_inventory/inventory/tables.py
2020-01-07 21:59:12 +01:00

101 lines
2.8 KiB
Python

import django_tables2 as tables
from .models import Backup
from .models import ComputerLicense
from .models import Device
from .models import DeviceInNet
from .models import Net
from .models import User
from .models import UserLicense
class ComputersTable(tables.Table):
name = tables.Column('Computer', linkify=True)
description = tables.Column()
serialnumber = tables.Column()
owner = tables.Column()
manufacturer = tables.Column()
location = tables.Column()
user = tables.Column('User', linkify=True)
installation_date = tables.Column()
os = tables.Column()
class Meta:
template_name = 'django_tables2/semantic.html'
class DevicesTable(tables.Table):
id = tables.Column(visible=False)
name = tables.Column('Device', linkify=True)
class Meta:
template_name = 'django_tables2/semantic.html'
model = Device
class NetsTable(tables.Table):
id = tables.Column(visible=False)
name = tables.Column('Net', linkify=True)
customer = tables.Column('Customer', linkify=True)
class Meta:
template_name = 'django_tables2/semantic.html'
model = Net
class BackupsTable(tables.Table):
id = tables.Column(visible=False)
name = tables.Column('Backup', linkify=True)
computer = tables.Column('Computer', linkify=True)
target_device = tables.ManyToManyColumn(linkify_item=True)
class Meta:
template_name = 'django_tables2/semantic.html'
model = Backup
class NetDetailTable(tables.Table):
device = tables.Column('Computer', linkify=True)
ip = tables.Column()
net = tables.Column(visible=False)
class Meta:
template_name = 'django_tables2/semantic.html'
model = DeviceInNet
class UserLicensesTable(tables.Table):
id = tables.Column(visible=False)
license_ptr = tables.Column(visible=False)
customer = tables.Column('Customer', linkify=True)
used_licenses = tables.Column()
user = tables.ManyToManyColumn(linkify_item=True)
class Meta:
template_name = 'django_tables2/semantic.html'
model = UserLicense
class ComputerLicensesTable(tables.Table):
id = tables.Column(visible=False)
license_ptr = tables.Column(visible=False)
customer = tables.Column('Customer', linkify=True)
used_licenses = tables.Column()
computer = tables.ManyToManyColumn(linkify_item=True)
class Meta:
template_name = 'django_tables2/semantic.html'
model = ComputerLicense
class UsersTable(tables.Table):
id = tables.Column(visible=False)
name = tables.Column('User', linkify=True)
customer = tables.Column('Customer', linkify=True)
ad_groups = tables.ManyToManyColumn()
mail_groups = tables.ManyToManyColumn()
class Meta:
template_name = 'django_tables2/semantic.html'
model = User