|
@@ -6,7 +6,7 @@ from utilities.tables import BaseTable, ToggleColumn
|
|
|
from .models import (
|
|
|
ConsolePort, ConsolePortTemplate, ConsoleServerPortTemplate, Device, DeviceBayTemplate, DeviceRole, DeviceType,
|
|
|
Interface, InterfaceTemplate, Manufacturer, Platform, PowerOutletTemplate, PowerPort, PowerPortTemplate, Rack,
|
|
|
- RackGroup, Region, Site,
|
|
|
+ RackGroup, RackReservation, Region, Site,
|
|
|
)
|
|
|
|
|
|
|
|
@@ -64,6 +64,12 @@ RACK_ROLE = """
|
|
|
{% endif %}
|
|
|
"""
|
|
|
|
|
|
+RACKRESERVATION_ACTIONS = """
|
|
|
+{% if perms.dcim.change_rackreservation %}
|
|
|
+ <a href="{% url 'dcim:rackreservation_edit' pk=record.pk %}" class="btn btn-xs btn-warning"><i class="glyphicon glyphicon-pencil" aria-hidden="true"></i></a>
|
|
|
+{% endif %}
|
|
|
+"""
|
|
|
+
|
|
|
DEVICEROLE_ACTIONS = """
|
|
|
{% if perms.dcim.change_devicerole %}
|
|
|
<a href="{% url 'dcim:devicerole_edit' slug=record.slug %}" class="btn btn-xs btn-warning"><i class="glyphicon glyphicon-pencil" aria-hidden="true"></i></a>
|
|
@@ -227,6 +233,23 @@ class RackImportTable(BaseTable):
|
|
|
|
|
|
|
|
|
#
|
|
|
+# Rack reservations
|
|
|
+#
|
|
|
+
|
|
|
+class RackReservationTable(BaseTable):
|
|
|
+ pk = ToggleColumn()
|
|
|
+ rack = tables.LinkColumn('dcim:rack', args=[Accessor('rack.pk')])
|
|
|
+ unit_list = tables.Column(orderable=False, verbose_name='Units')
|
|
|
+ actions = tables.TemplateColumn(
|
|
|
+ template_code=RACKRESERVATION_ACTIONS, attrs={'td': {'class': 'text-right'}}, verbose_name=''
|
|
|
+ )
|
|
|
+
|
|
|
+ class Meta(BaseTable.Meta):
|
|
|
+ model = RackReservation
|
|
|
+ fields = ('pk', 'rack', 'unit_list', 'user', 'created', 'description', 'actions')
|
|
|
+
|
|
|
+
|
|
|
+#
|
|
|
# Manufacturers
|
|
|
#
|
|
|
|