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

Implemented DeviceType component template creation and deletion

This commit is contained in:
Jeremy Stretch
2016-03-04 23:09:32 -05:00
parent 009ef41e92
commit 61cbee15ca
6 changed files with 237 additions and 86 deletions

View File

@@ -1,7 +1,8 @@
import django_tables2 as tables
from django_tables2.utils import Accessor
from .models import Site, Rack, DeviceType, Device, ConsolePort, PowerPort
from .models import Site, Rack, DeviceType, ConsolePortTemplate, ConsoleServerPortTemplate, PowerPortTemplate, \
PowerOutletTemplate, InterfaceTemplate, Device, ConsolePort, PowerPort
PREFIXES_PER_VLAN = """
@@ -98,6 +99,112 @@ class DeviceTypeBulkEditTable(DeviceTypeTable):
fields = ('pk', 'model', 'manufacturer', 'u_height')
#
# Device type components
#
class ConsolePortTemplateTable(tables.Table):
class Meta:
model = ConsolePortTemplate
fields = ('name',)
empty_text = "None"
show_header = False
attrs = {
'class': 'table table-hover panel-body',
}
class ConsolePortTemplateBulkDeleteTable(ConsolePortTemplateTable):
pk = tables.CheckBoxColumn()
class Meta(ConsolePortTemplateTable.Meta):
model = None # django_tables2 bugfix
fields = ('pk', 'name')
class ConsoleServerPortTemplateTable(tables.Table):
class Meta:
model = ConsoleServerPortTemplate
fields = ('name',)
empty_text = "None"
show_header = False
attrs = {
'class': 'table table-hover panel-body',
}
class ConsoleServerPortTemplateBulkDeleteTable(ConsoleServerPortTemplateTable):
pk = tables.CheckBoxColumn()
class Meta(ConsoleServerPortTemplateTable.Meta):
model = None # django_tables2 bugfix
fields = ('pk', 'name')
class PowerPortTemplateTable(tables.Table):
class Meta:
model = PowerPortTemplate
fields = ('name',)
empty_text = "None"
show_header = False
attrs = {
'class': 'table table-hover panel-body',
}
class PowerPortTemplateBulkDeleteTable(PowerPortTemplateTable):
pk = tables.CheckBoxColumn()
class Meta(PowerPortTemplateTable.Meta):
model = None # django_tables2 bugfix
fields = ('pk', 'name')
class PowerOutletTemplateTable(tables.Table):
class Meta:
model = PowerOutletTemplate
fields = ('name',)
empty_text = "None"
show_header = False
attrs = {
'class': 'table table-hover panel-body',
}
class PowerOutletTemplateBulkDeleteTable(PowerOutletTemplateTable):
pk = tables.CheckBoxColumn()
class Meta(PowerOutletTemplateTable.Meta):
model = None # django_tables2 bugfix
fields = ('pk', 'name')
class InterfaceTemplateTable(tables.Table):
class Meta:
model = InterfaceTemplate
fields = ('name',)
empty_text = "None"
show_header = False
attrs = {
'class': 'table table-hover panel-body',
}
class InterfaceTemplateBulkDeleteTable(InterfaceTemplateTable):
pk = tables.CheckBoxColumn()
class Meta(InterfaceTemplateTable.Meta):
model = None # django_tables2 bugfix
fields = ('pk', 'name')
#
# Devices
#