network_inventory/nets/tables.py

40 lines
949 B
Python
Raw Normal View History

2020-01-10 00:01:06 +01:00
import django_tables2 as tables
2020-08-03 17:08:57 +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 devices.models import DeviceInNet
from .models import Net
class NetsTable(CoreTable):
2020-01-10 00:01:06 +01:00
id = tables.Column(visible=False)
2022-03-27 14:50:44 +02:00
name = tables.Column("Net", linkify=True)
customer = tables.Column("Customer", linkify=True)
description = tables.Column(
2022-03-27 14:50:44 +02:00
attrs={"td": {"class": "text-truncate", "style": "max-width: 150px;"}}
)
delete = tables.LinkColumn(
"net_delete",
text="delete",
args=[A("pk")],
attrs={
2022-03-27 14:50:44 +02:00
"a": {
"class": "delete material-icons",
}
},
orderable=False,
)
2020-01-10 00:01:06 +01:00
class Meta(CoreTable.Meta):
2020-01-10 00:01:06 +01:00
model = Net
class NetDetailTable(CoreTable):
2020-02-15 18:50:51 +01:00
device = tables.Column(linkify=True)
2020-01-10 00:01:06 +01:00
ip = tables.Column()
net = tables.Column(visible=False)
class Meta(CoreTable.Meta):
2020-01-10 00:01:06 +01:00
model = DeviceInNet