Initial work on a front end for managing DeviceTypes

This commit is contained in:
Jeremy Stretch
2016-03-04 14:39:39 -05:00
parent 0b1df1e60d
commit 32f6b3694a
12 changed files with 474 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
import django_tables2 as tables
from django_tables2.utils import Accessor
from .models import Site, Rack, Device, ConsolePort, PowerPort
from .models import Site, Rack, DeviceType, Device, ConsolePort, PowerPort
PREFIXES_PER_VLAN = """
@@ -74,6 +74,30 @@ class RackBulkEditTable(RackTable):
fields = ('pk', 'name', 'site', 'group', 'facility_id', 'u_height')
#
# Device types
#
class DeviceTypeTable(tables.Table):
model = tables.LinkColumn('dcim:devicetype', args=[Accessor('pk')], verbose_name='Device Type')
class Meta:
model = DeviceType
fields = ('model', 'manufacturer', 'u_height')
empty_text = "No device types were found."
attrs = {
'class': 'table table-hover',
}
class DeviceTypeBulkEditTable(DeviceTypeTable):
pk = tables.CheckBoxColumn()
class Meta(DeviceTypeTable.Meta):
model = None # django_tables2 bugfix
fields = ('pk', 'model', 'manufacturer', 'u_height')
#
# Devices
#