1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Introduce ServiceTemplate

This commit is contained in:
jeremystretch
2022-01-12 16:42:28 -05:00
parent c8713d94d8
commit 97e7ef9a3f
24 changed files with 427 additions and 40 deletions

View File

@@ -5,12 +5,27 @@ from ipam.models import *
__all__ = (
'ServiceTable',
'ServiceTemplateTable',
)
#
# Services
#
class ServiceTemplateTable(BaseTable):
pk = ToggleColumn()
name = tables.Column(
linkify=True
)
ports = tables.Column(
accessor=tables.A('port_list')
)
tags = TagColumn(
url_name='ipam:servicetemplate_list'
)
class Meta(BaseTable.Meta):
model = ServiceTemplate
fields = ('pk', 'id', 'name', 'protocol', 'ports', 'description', 'tags')
default_columns = ('pk', 'name', 'protocol', 'ports', 'description')
class ServiceTable(BaseTable):
pk = ToggleColumn()
@@ -21,9 +36,8 @@ class ServiceTable(BaseTable):
linkify=True,
order_by=('device', 'virtual_machine')
)
ports = tables.TemplateColumn(
template_code='{{ record.port_list }}',
verbose_name='Ports'
ports = tables.Column(
accessor=tables.A('port_list')
)
tags = TagColumn(
url_name='ipam:service_list'