Merge pull request #5361 from netbox-community/5305-standardize-object-views

#5305: Optimize ObjectView to minimize view boilerplate
This commit is contained in:
Jeremy Stretch 2020-11-19 16:47:23 -05:00 committed by GitHub
commit 6ce5cb24ba
72 changed files with 1480 additions and 1610 deletions

View File

@ -26,11 +26,9 @@ class ProviderListView(generic.ObjectListView):
class ProviderView(generic.ObjectView): class ProviderView(generic.ObjectView):
queryset = Provider.objects.all() queryset = Provider.objects.all()
def get(self, request, slug): def get_extra_context(self, request, instance):
provider = get_object_or_404(self.queryset, slug=slug)
circuits = Circuit.objects.restrict(request.user, 'view').filter( circuits = Circuit.objects.restrict(request.user, 'view').filter(
provider=provider provider=instance
).prefetch_related( ).prefetch_related(
'type', 'tenant', 'terminations__site' 'type', 'tenant', 'terminations__site'
).annotate_sites() ).annotate_sites()
@ -44,10 +42,9 @@ class ProviderView(generic.ObjectView):
} }
RequestConfig(request, paginate).configure(circuits_table) RequestConfig(request, paginate).configure(circuits_table)
return render(request, 'circuits/provider.html', { return {
'provider': provider,
'circuits_table': circuits_table, 'circuits_table': circuits_table,
}) }
class ProviderEditView(generic.ObjectEditView): class ProviderEditView(generic.ObjectEditView):
@ -124,30 +121,30 @@ class CircuitListView(generic.ObjectListView):
class CircuitView(generic.ObjectView): class CircuitView(generic.ObjectView):
queryset = Circuit.objects.all() queryset = Circuit.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
circuit = get_object_or_404(self.queryset, pk=pk)
# A-side termination
termination_a = CircuitTermination.objects.restrict(request.user, 'view').prefetch_related( termination_a = CircuitTermination.objects.restrict(request.user, 'view').prefetch_related(
'site__region' 'site__region'
).filter( ).filter(
circuit=circuit, term_side=CircuitTerminationSideChoices.SIDE_A circuit=instance, term_side=CircuitTerminationSideChoices.SIDE_A
).first() ).first()
if termination_a and termination_a.connected_endpoint: if termination_a and termination_a.connected_endpoint:
termination_a.ip_addresses = termination_a.connected_endpoint.ip_addresses.restrict(request.user, 'view') termination_a.ip_addresses = termination_a.connected_endpoint.ip_addresses.restrict(request.user, 'view')
# Z-side termination
termination_z = CircuitTermination.objects.restrict(request.user, 'view').prefetch_related( termination_z = CircuitTermination.objects.restrict(request.user, 'view').prefetch_related(
'site__region' 'site__region'
).filter( ).filter(
circuit=circuit, term_side=CircuitTerminationSideChoices.SIDE_Z circuit=instance, term_side=CircuitTerminationSideChoices.SIDE_Z
).first() ).first()
if termination_z and termination_z.connected_endpoint: if termination_z and termination_z.connected_endpoint:
termination_z.ip_addresses = termination_z.connected_endpoint.ip_addresses.restrict(request.user, 'view') termination_z.ip_addresses = termination_z.connected_endpoint.ip_addresses.restrict(request.user, 'view')
return render(request, 'circuits/circuit.html', { return {
'circuit': circuit,
'termination_a': termination_a, 'termination_a': termination_a,
'termination_z': termination_z, 'termination_z': termination_z,
}) }
class CircuitEditView(generic.ObjectEditView): class CircuitEditView(generic.ObjectEditView):

View File

@ -100,9 +100,9 @@ CONSOLEPORT_BUTTONS = """
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='console-server-port' %}?return_url={% url 'dcim:device_consoleports' pk=device.pk %}">Console Server Port</a></li> <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='console-server-port' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}">Console Server Port</a></li>
<li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_consoleports' pk=device.pk %}">Front Port</a></li> <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}">Front Port</a></li>
<li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_consoleports' pk=device.pk %}">Rear Port</a></li> <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}">Rear Port</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
@ -120,9 +120,9 @@ CONSOLESERVERPORT_BUTTONS = """
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=record.pk termination_b_type='console-port' %}?return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}">Console Port</a></li> <li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=record.pk termination_b_type='console-port' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}">Console Port</a></li>
<li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}">Front Port</a></li> <li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}">Front Port</a></li>
<li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}">Rear Port</a></li> <li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}">Rear Port</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
@ -140,8 +140,8 @@ POWERPORT_BUTTONS = """
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:powerport_connect' termination_a_id=record.pk termination_b_type='power-outlet' %}?return_url={% url 'dcim:device_powerports' pk=device.pk %}">Power Outlet</a></li> <li><a href="{% url 'dcim:powerport_connect' termination_a_id=record.pk termination_b_type='power-outlet' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}">Power Outlet</a></li>
<li><a href="{% url 'dcim:powerport_connect' termination_a_id=record.pk termination_b_type='power-feed' %}?return_url={% url 'dcim:device_powerports' pk=device.pk %}">Power Feed</a></li> <li><a href="{% url 'dcim:powerport_connect' termination_a_id=record.pk termination_b_type='power-feed' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}">Power Feed</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
@ -154,7 +154,7 @@ POWEROUTLET_BUTTONS = """
{% elif perms.dcim.add_cable %} {% elif perms.dcim.add_cable %}
<a href="#" class="btn btn-default btn-xs disabled"><i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i></a> <a href="#" class="btn btn-default btn-xs disabled"><i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i></a>
<a href="#" class="btn btn-default btn-xs disabled"><i class="mdi mdi-lan-connect" aria-hidden="true"></i></a> <a href="#" class="btn btn-default btn-xs disabled"><i class="mdi mdi-lan-connect" aria-hidden="true"></i></a>
<a href="{% url 'dcim:poweroutlet_connect' termination_a_id=record.pk termination_b_type='power-port' %}?return_url={% url 'dcim:device_poweroutlets' pk=device.pk %}" title="Connect" class="btn btn-success btn-xs"> <a href="{% url 'dcim:poweroutlet_connect' termination_a_id=record.pk termination_b_type='power-port' %}?return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" title="Connect" class="btn btn-success btn-xs">
<i class="mdi mdi-ethernet-cable" aria-hidden="true"></i> <i class="mdi mdi-ethernet-cable" aria-hidden="true"></i>
</a> </a>
{% endif %} {% endif %}
@ -162,7 +162,7 @@ POWEROUTLET_BUTTONS = """
INTERFACE_BUTTONS = """ INTERFACE_BUTTONS = """
{% if perms.ipam.add_ipaddress %} {% if perms.ipam.add_ipaddress %}
<a href="{% url 'ipam:ipaddress_add' %}?interface={{ record.pk }}&return_url={% url 'dcim:device_interfaces' pk=device.pk %}" class="btn btn-xs btn-success" title="Add IP address"> <a href="{% url 'ipam:ipaddress_add' %}?interface={{ record.pk }}&return_url={% url 'dcim:device_interfaces' pk=object.pk %}" class="btn btn-xs btn-success" title="Add IP address">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
</a> </a>
{% endif %} {% endif %}
@ -177,10 +177,10 @@ INTERFACE_BUTTONS = """
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='interface' %}?return_url={% url 'dcim:device_interfaces' pk=device.pk %}">Interface</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='interface' %}?return_url={% url 'dcim:device_interfaces' pk=object.pk %}">Interface</a></li>
<li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_interfaces' pk=device.pk %}">Front Port</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_interfaces' pk=object.pk %}">Front Port</a></li>
<li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_interfaces' pk=device.pk %}">Rear Port</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_interfaces' pk=object.pk %}">Rear Port</a></li>
<li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='circuit-termination' %}?return_url={% url 'dcim:device_interfaces' pk=device.pk %}">Circuit Termination</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=record.pk termination_b_type='circuit-termination' %}?return_url={% url 'dcim:device_interfaces' pk=object.pk %}">Circuit Termination</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
@ -198,12 +198,12 @@ FRONTPORT_BUTTONS = """
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='interface' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}">Interface</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='interface' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}">Interface</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='console-server-port' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}">Console Server Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='console-server-port' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}">Console Server Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='console-port' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}">Console Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='console-port' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}">Console Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}">Front Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}">Front Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}">Rear Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}">Rear Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='circuit-termination' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}">Circuit Termination</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=record.pk termination_b_type='circuit-termination' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}">Circuit Termination</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
@ -221,10 +221,10 @@ REARPORT_BUTTONS = """
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='interface' %}?return_url={% url 'dcim:device_rearports' pk=device.pk %}">Interface</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='interface' %}?return_url={% url 'dcim:device_rearports' pk=object.pk %}">Interface</a></li>
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_rearports' pk=device.pk %}">Front Port</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={% url 'dcim:device_rearports' pk=object.pk %}">Front Port</a></li>
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_rearports' pk=device.pk %}">Rear Port</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={% url 'dcim:device_rearports' pk=object.pk %}">Rear Port</a></li>
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='circuit-termination' %}?return_url={% url 'dcim:device_rearports' pk=device.pk %}">Circuit Termination</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=record.pk termination_b_type='circuit-termination' %}?return_url={% url 'dcim:device_rearports' pk=object.pk %}">Circuit Termination</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
@ -233,11 +233,11 @@ REARPORT_BUTTONS = """
DEVICEBAY_BUTTONS = """ DEVICEBAY_BUTTONS = """
{% if perms.dcim.change_devicebay %} {% if perms.dcim.change_devicebay %}
{% if record.installed_device %} {% if record.installed_device %}
<a href="{% url 'dcim:devicebay_depopulate' pk=record.pk %}?return_url={% url 'dcim:device_devicebays' pk=device.pk %}" class="btn btn-danger btn-xs"> <a href="{% url 'dcim:devicebay_depopulate' pk=record.pk %}?return_url={% url 'dcim:device_devicebays' pk=object.pk %}" class="btn btn-danger btn-xs">
<i class="mdi mdi-minus-thick" aria-hidden="true" title="Remove device"></i> <i class="mdi mdi-minus-thick" aria-hidden="true" title="Remove device"></i>
</a> </a>
{% else %} {% else %}
<a href="{% url 'dcim:devicebay_populate' pk=record.pk %}?return_url={% url 'dcim:device_devicebays' pk=device.pk %}" class="btn btn-success btn-xs"> <a href="{% url 'dcim:devicebay_populate' pk=record.pk %}?return_url={% url 'dcim:device_devicebays' pk=object.pk %}" class="btn btn-success btn-xs">
<i class="mdi mdi-plus-thick" aria-hidden="true" title="Install device"></i> <i class="mdi mdi-plus-thick" aria-hidden="true" title="Install device"></i>
</a> </a>
{% endif %} {% endif %}

View File

@ -197,7 +197,7 @@ urlpatterns = [
path('devices/<int:pk>/device-bays/', views.DeviceDeviceBaysView.as_view(), name='device_devicebays'), path('devices/<int:pk>/device-bays/', views.DeviceDeviceBaysView.as_view(), name='device_devicebays'),
path('devices/<int:pk>/inventory/', views.DeviceInventoryView.as_view(), name='device_inventory'), path('devices/<int:pk>/inventory/', views.DeviceInventoryView.as_view(), name='device_inventory'),
path('devices/<int:pk>/config-context/', views.DeviceConfigContextView.as_view(), name='device_configcontext'), path('devices/<int:pk>/config-context/', views.DeviceConfigContextView.as_view(), name='device_configcontext'),
path('devices/<int:pk>/changelog/', ObjectChangeLogView.as_view(), name='device_changelog', kwargs={'model': Device}), path('devices/<int:pk>/changelog/', views.DeviceChangeLogView.as_view(), name='device_changelog', kwargs={'model': Device}),
path('devices/<int:pk>/status/', views.DeviceStatusView.as_view(), name='device_status'), path('devices/<int:pk>/status/', views.DeviceStatusView.as_view(), name='device_status'),
path('devices/<int:pk>/lldp-neighbors/', views.DeviceLLDPNeighborsView.as_view(), name='device_lldp_neighbors'), path('devices/<int:pk>/lldp-neighbors/', views.DeviceLLDPNeighborsView.as_view(), name='device_lldp_neighbors'),
path('devices/<int:pk>/config/', views.DeviceConfigView.as_view(), name='device_config'), path('devices/<int:pk>/config/', views.DeviceConfigView.as_view(), name='device_config'),

View File

@ -12,7 +12,7 @@ from django.utils.safestring import mark_safe
from django.views.generic import View from django.views.generic import View
from circuits.models import Circuit from circuits.models import Circuit
from extras.views import ObjectConfigContextView from extras.views import ObjectChangeLogView, ObjectConfigContextView
from ipam.models import IPAddress, Prefix, Service, VLAN from ipam.models import IPAddress, Prefix, Service, VLAN
from ipam.tables import InterfaceIPAddressTable, InterfaceVLANTable from ipam.tables import InterfaceIPAddressTable, InterfaceVLANTable
from netbox.views import generic from netbox.views import generic
@ -152,16 +152,14 @@ class SiteListView(generic.ObjectListView):
class SiteView(generic.ObjectView): class SiteView(generic.ObjectView):
queryset = Site.objects.prefetch_related('region', 'tenant__group') queryset = Site.objects.prefetch_related('region', 'tenant__group')
def get(self, request, slug): def get_extra_context(self, request, instance):
site = get_object_or_404(self.queryset, slug=slug)
stats = { stats = {
'rack_count': Rack.objects.restrict(request.user, 'view').filter(site=site).count(), 'rack_count': Rack.objects.restrict(request.user, 'view').filter(site=instance).count(),
'device_count': Device.objects.restrict(request.user, 'view').filter(site=site).count(), 'device_count': Device.objects.restrict(request.user, 'view').filter(site=instance).count(),
'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(site=site).count(), 'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(site=instance).count(),
'vlan_count': VLAN.objects.restrict(request.user, 'view').filter(site=site).count(), 'vlan_count': VLAN.objects.restrict(request.user, 'view').filter(site=instance).count(),
'circuit_count': Circuit.objects.restrict(request.user, 'view').filter(terminations__site=site).count(), 'circuit_count': Circuit.objects.restrict(request.user, 'view').filter(terminations__site=instance).count(),
'vm_count': VirtualMachine.objects.restrict(request.user, 'view').filter(cluster__site=site).count(), 'vm_count': VirtualMachine.objects.restrict(request.user, 'view').filter(cluster__site=instance).count(),
} }
rack_groups = RackGroup.objects.add_related_count( rack_groups = RackGroup.objects.add_related_count(
RackGroup.objects.all(), RackGroup.objects.all(),
@ -169,13 +167,12 @@ class SiteView(generic.ObjectView):
'group', 'group',
'rack_count', 'rack_count',
cumulative=True cumulative=True
).restrict(request.user, 'view').filter(site=site) ).restrict(request.user, 'view').filter(site=instance)
return render(request, 'dcim/site.html', { return {
'site': site,
'stats': stats, 'stats': stats,
'rack_groups': rack_groups, 'rack_groups': rack_groups,
}) }
class SiteEditView(generic.ObjectEditView): class SiteEditView(generic.ObjectEditView):
@ -338,36 +335,37 @@ class RackElevationListView(generic.ObjectListView):
class RackView(generic.ObjectView): class RackView(generic.ObjectView):
queryset = Rack.objects.prefetch_related('site__region', 'tenant__group', 'group', 'role') queryset = Rack.objects.prefetch_related('site__region', 'tenant__group', 'group', 'role')
def get(self, request, pk): def get_extra_context(self, request, instance):
rack = get_object_or_404(self.queryset, pk=pk)
# Get 0U and child devices located within the rack # Get 0U and child devices located within the rack
nonracked_devices = Device.objects.filter( nonracked_devices = Device.objects.filter(
rack=rack, rack=instance,
position__isnull=True position__isnull=True
).prefetch_related('device_type__manufacturer') ).prefetch_related('device_type__manufacturer')
peer_racks = Rack.objects.restrict(request.user, 'view').filter(site=rack.site) peer_racks = Rack.objects.restrict(request.user, 'view').filter(site=instance.site)
if rack.group: if instance.group:
peer_racks = peer_racks.filter(group=rack.group) peer_racks = peer_racks.filter(group=instance.group)
else: else:
peer_racks = peer_racks.filter(group__isnull=True) peer_racks = peer_racks.filter(group__isnull=True)
next_rack = peer_racks.filter(name__gt=rack.name).order_by('name').first() next_rack = peer_racks.filter(name__gt=instance.name).order_by('name').first()
prev_rack = peer_racks.filter(name__lt=rack.name).order_by('-name').first() prev_rack = peer_racks.filter(name__lt=instance.name).order_by('-name').first()
reservations = RackReservation.objects.restrict(request.user, 'view').filter(rack=rack) reservations = RackReservation.objects.restrict(request.user, 'view').filter(rack=instance)
power_feeds = PowerFeed.objects.restrict(request.user, 'view').filter(rack=rack).prefetch_related('power_panel') power_feeds = PowerFeed.objects.restrict(request.user, 'view').filter(rack=instance).prefetch_related(
'power_panel'
)
return render(request, 'dcim/rack.html', { device_count = Device.objects.restrict(request.user, 'view').filter(rack=instance).count()
'rack': rack,
'device_count': Device.objects.restrict(request.user, 'view').filter(rack=rack).count(), return {
'device_count': device_count,
'reservations': reservations, 'reservations': reservations,
'power_feeds': power_feeds, 'power_feeds': power_feeds,
'nonracked_devices': nonracked_devices, 'nonracked_devices': nonracked_devices,
'next_rack': next_rack, 'next_rack': next_rack,
'prev_rack': prev_rack, 'prev_rack': prev_rack,
}) }
class RackEditView(generic.ObjectEditView): class RackEditView(generic.ObjectEditView):
@ -413,14 +411,6 @@ class RackReservationListView(generic.ObjectListView):
class RackReservationView(generic.ObjectView): class RackReservationView(generic.ObjectView):
queryset = RackReservation.objects.prefetch_related('rack') queryset = RackReservation.objects.prefetch_related('rack')
def get(self, request, pk):
rackreservation = get_object_or_404(self.queryset, pk=pk)
return render(request, 'dcim/rackreservation.html', {
'rackreservation': rackreservation,
})
class RackReservationEditView(generic.ObjectEditView): class RackReservationEditView(generic.ObjectEditView):
queryset = RackReservation.objects.all() queryset = RackReservation.objects.all()
@ -519,42 +509,40 @@ class DeviceTypeListView(generic.ObjectListView):
class DeviceTypeView(generic.ObjectView): class DeviceTypeView(generic.ObjectView):
queryset = DeviceType.objects.prefetch_related('manufacturer') queryset = DeviceType.objects.prefetch_related('manufacturer')
def get(self, request, pk): def get_extra_context(self, request, instance):
instance_count = Device.objects.restrict(request.user).filter(device_type=instance).count()
devicetype = get_object_or_404(self.queryset, pk=pk)
instance_count = Device.objects.restrict(request.user).filter(device_type=devicetype).count()
# Component tables # Component tables
consoleport_table = tables.ConsolePortTemplateTable( consoleport_table = tables.ConsolePortTemplateTable(
ConsolePortTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype), ConsolePortTemplate.objects.restrict(request.user, 'view').filter(device_type=instance),
orderable=False orderable=False
) )
consoleserverport_table = tables.ConsoleServerPortTemplateTable( consoleserverport_table = tables.ConsoleServerPortTemplateTable(
ConsoleServerPortTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype), ConsoleServerPortTemplate.objects.restrict(request.user, 'view').filter(device_type=instance),
orderable=False orderable=False
) )
powerport_table = tables.PowerPortTemplateTable( powerport_table = tables.PowerPortTemplateTable(
PowerPortTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype), PowerPortTemplate.objects.restrict(request.user, 'view').filter(device_type=instance),
orderable=False orderable=False
) )
poweroutlet_table = tables.PowerOutletTemplateTable( poweroutlet_table = tables.PowerOutletTemplateTable(
PowerOutletTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype), PowerOutletTemplate.objects.restrict(request.user, 'view').filter(device_type=instance),
orderable=False orderable=False
) )
interface_table = tables.InterfaceTemplateTable( interface_table = tables.InterfaceTemplateTable(
list(InterfaceTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype)), list(InterfaceTemplate.objects.restrict(request.user, 'view').filter(device_type=instance)),
orderable=False orderable=False
) )
front_port_table = tables.FrontPortTemplateTable( front_port_table = tables.FrontPortTemplateTable(
FrontPortTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype), FrontPortTemplate.objects.restrict(request.user, 'view').filter(device_type=instance),
orderable=False orderable=False
) )
rear_port_table = tables.RearPortTemplateTable( rear_port_table = tables.RearPortTemplateTable(
RearPortTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype), RearPortTemplate.objects.restrict(request.user, 'view').filter(device_type=instance),
orderable=False orderable=False
) )
devicebay_table = tables.DeviceBayTemplateTable( devicebay_table = tables.DeviceBayTemplateTable(
DeviceBayTemplate.objects.restrict(request.user, 'view').filter(device_type=devicetype), DeviceBayTemplate.objects.restrict(request.user, 'view').filter(device_type=instance),
orderable=False orderable=False
) )
if request.user.has_perm('dcim.change_devicetype'): if request.user.has_perm('dcim.change_devicetype'):
@ -567,8 +555,7 @@ class DeviceTypeView(generic.ObjectView):
rear_port_table.columns.show('pk') rear_port_table.columns.show('pk')
devicebay_table.columns.show('pk') devicebay_table.columns.show('pk')
return render(request, 'dcim/devicetype.html', { return {
'devicetype': devicetype,
'instance_count': instance_count, 'instance_count': instance_count,
'consoleport_table': consoleport_table, 'consoleport_table': consoleport_table,
'consoleserverport_table': consoleserverport_table, 'consoleserverport_table': consoleserverport_table,
@ -578,7 +565,7 @@ class DeviceTypeView(generic.ObjectView):
'front_port_table': front_port_table, 'front_port_table': front_port_table,
'rear_port_table': rear_port_table, 'rear_port_table': rear_port_table,
'devicebay_table': devicebay_table, 'devicebay_table': devicebay_table,
}) }
class DeviceTypeEditView(generic.ObjectEditView): class DeviceTypeEditView(generic.ObjectEditView):
@ -995,50 +982,45 @@ class DeviceView(generic.ObjectView):
'site__region', 'rack__group', 'tenant__group', 'device_role', 'platform', 'primary_ip4', 'primary_ip6' 'site__region', 'rack__group', 'tenant__group', 'device_role', 'platform', 'primary_ip4', 'primary_ip6'
) )
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk)
# VirtualChassis members # VirtualChassis members
if device.virtual_chassis is not None: if instance.virtual_chassis is not None:
vc_members = Device.objects.restrict(request.user, 'view').filter( vc_members = Device.objects.restrict(request.user, 'view').filter(
virtual_chassis=device.virtual_chassis virtual_chassis=instance.virtual_chassis
).order_by('vc_position') ).order_by('vc_position')
else: else:
vc_members = [] vc_members = []
# Services # Services
services = Service.objects.restrict(request.user, 'view').filter(device=device) services = Service.objects.restrict(request.user, 'view').filter(device=instance)
# Secrets # Secrets
secrets = Secret.objects.restrict(request.user, 'view').filter(device=device) secrets = Secret.objects.restrict(request.user, 'view').filter(device=instance)
# Find up to ten devices in the same site with the same functional role for quick reference. # Find up to ten devices in the same site with the same functional role for quick reference.
related_devices = Device.objects.restrict(request.user, 'view').filter( related_devices = Device.objects.restrict(request.user, 'view').filter(
site=device.site, device_role=device.device_role site=instance.site, device_role=instance.device_role
).exclude( ).exclude(
pk=device.pk pk=instance.pk
).prefetch_related( ).prefetch_related(
'rack', 'device_type__manufacturer' 'rack', 'device_type__manufacturer'
)[:10] )[:10]
return render(request, 'dcim/device/device.html', { return {
'device': device,
'services': services, 'services': services,
'secrets': secrets, 'secrets': secrets,
'vc_members': vc_members, 'vc_members': vc_members,
'related_devices': related_devices, 'related_devices': related_devices,
'active_tab': 'device', 'active_tab': 'device',
}) }
class DeviceConsolePortsView(generic.ObjectView): class DeviceConsolePortsView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/consoleports.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) consoleports = ConsolePort.objects.restrict(request.user, 'view').filter(device=instance).prefetch_related(
consoleports = ConsolePort.objects.restrict(request.user, 'view').filter(device=device).prefetch_related(
'cable', '_path__destination', 'cable', '_path__destination',
) )
consoleport_table = tables.DeviceConsolePortTable( consoleport_table = tables.DeviceConsolePortTable(
@ -1049,21 +1031,19 @@ class DeviceConsolePortsView(generic.ObjectView):
if request.user.has_perm('dcim.change_consoleport') or request.user.has_perm('dcim.delete_consoleport'): if request.user.has_perm('dcim.change_consoleport') or request.user.has_perm('dcim.delete_consoleport'):
consoleport_table.columns.show('pk') consoleport_table.columns.show('pk')
return render(request, 'dcim/device/consoleports.html', { return {
'device': device,
'consoleport_table': consoleport_table, 'consoleport_table': consoleport_table,
'active_tab': 'console-ports', 'active_tab': 'console-ports',
}) }
class DeviceConsoleServerPortsView(generic.ObjectView): class DeviceConsoleServerPortsView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/consoleserverports.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk)
consoleserverports = ConsoleServerPort.objects.restrict(request.user, 'view').filter( consoleserverports = ConsoleServerPort.objects.restrict(request.user, 'view').filter(
device=device device=instance
).prefetch_related( ).prefetch_related(
'cable', '_path__destination', 'cable', '_path__destination',
) )
@ -1076,20 +1056,18 @@ class DeviceConsoleServerPortsView(generic.ObjectView):
request.user.has_perm('dcim.delete_consoleserverport'): request.user.has_perm('dcim.delete_consoleserverport'):
consoleserverport_table.columns.show('pk') consoleserverport_table.columns.show('pk')
return render(request, 'dcim/device/consoleserverports.html', { return {
'device': device,
'consoleserverport_table': consoleserverport_table, 'consoleserverport_table': consoleserverport_table,
'active_tab': 'console-server-ports', 'active_tab': 'console-server-ports',
}) }
class DevicePowerPortsView(generic.ObjectView): class DevicePowerPortsView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/powerports.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) powerports = PowerPort.objects.restrict(request.user, 'view').filter(device=instance).prefetch_related(
powerports = PowerPort.objects.restrict(request.user, 'view').filter(device=device).prefetch_related(
'cable', '_path__destination', 'cable', '_path__destination',
) )
powerport_table = tables.DevicePowerPortTable( powerport_table = tables.DevicePowerPortTable(
@ -1100,20 +1078,18 @@ class DevicePowerPortsView(generic.ObjectView):
if request.user.has_perm('dcim.change_powerport') or request.user.has_perm('dcim.delete_powerport'): if request.user.has_perm('dcim.change_powerport') or request.user.has_perm('dcim.delete_powerport'):
powerport_table.columns.show('pk') powerport_table.columns.show('pk')
return render(request, 'dcim/device/powerports.html', { return {
'device': device,
'powerport_table': powerport_table, 'powerport_table': powerport_table,
'active_tab': 'power-ports', 'active_tab': 'power-ports',
}) }
class DevicePowerOutletsView(generic.ObjectView): class DevicePowerOutletsView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/poweroutlets.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) poweroutlets = PowerOutlet.objects.restrict(request.user, 'view').filter(device=instance).prefetch_related(
poweroutlets = PowerOutlet.objects.restrict(request.user, 'view').filter(device=device).prefetch_related(
'cable', 'power_port', '_path__destination', 'cable', 'power_port', '_path__destination',
) )
poweroutlet_table = tables.DevicePowerOutletTable( poweroutlet_table = tables.DevicePowerOutletTable(
@ -1124,20 +1100,18 @@ class DevicePowerOutletsView(generic.ObjectView):
if request.user.has_perm('dcim.change_poweroutlet') or request.user.has_perm('dcim.delete_poweroutlet'): if request.user.has_perm('dcim.change_poweroutlet') or request.user.has_perm('dcim.delete_poweroutlet'):
poweroutlet_table.columns.show('pk') poweroutlet_table.columns.show('pk')
return render(request, 'dcim/device/poweroutlets.html', { return {
'device': device,
'poweroutlet_table': poweroutlet_table, 'poweroutlet_table': poweroutlet_table,
'active_tab': 'power-outlets', 'active_tab': 'power-outlets',
}) }
class DeviceInterfacesView(generic.ObjectView): class DeviceInterfacesView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/interfaces.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) interfaces = instance.vc_interfaces.restrict(request.user, 'view').prefetch_related(
interfaces = device.vc_interfaces.restrict(request.user, 'view').prefetch_related(
Prefetch('ip_addresses', queryset=IPAddress.objects.restrict(request.user)), Prefetch('ip_addresses', queryset=IPAddress.objects.restrict(request.user)),
Prefetch('member_interfaces', queryset=Interface.objects.restrict(request.user)), Prefetch('member_interfaces', queryset=Interface.objects.restrict(request.user)),
'lag', 'cable', '_path__destination', 'tags', 'lag', 'cable', '_path__destination', 'tags',
@ -1150,20 +1124,18 @@ class DeviceInterfacesView(generic.ObjectView):
if request.user.has_perm('dcim.change_interface') or request.user.has_perm('dcim.delete_interface'): if request.user.has_perm('dcim.change_interface') or request.user.has_perm('dcim.delete_interface'):
interface_table.columns.show('pk') interface_table.columns.show('pk')
return render(request, 'dcim/device/interfaces.html', { return {
'device': device,
'interface_table': interface_table, 'interface_table': interface_table,
'active_tab': 'interfaces', 'active_tab': 'interfaces',
}) }
class DeviceFrontPortsView(generic.ObjectView): class DeviceFrontPortsView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/frontports.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) frontports = FrontPort.objects.restrict(request.user, 'view').filter(device=instance).prefetch_related(
frontports = FrontPort.objects.restrict(request.user, 'view').filter(device=device).prefetch_related(
'rear_port', 'cable', 'rear_port', 'cable',
) )
frontport_table = tables.DeviceFrontPortTable( frontport_table = tables.DeviceFrontPortTable(
@ -1174,20 +1146,18 @@ class DeviceFrontPortsView(generic.ObjectView):
if request.user.has_perm('dcim.change_frontport') or request.user.has_perm('dcim.delete_frontport'): if request.user.has_perm('dcim.change_frontport') or request.user.has_perm('dcim.delete_frontport'):
frontport_table.columns.show('pk') frontport_table.columns.show('pk')
return render(request, 'dcim/device/frontports.html', { return {
'device': device,
'frontport_table': frontport_table, 'frontport_table': frontport_table,
'active_tab': 'front-ports', 'active_tab': 'front-ports',
}) }
class DeviceRearPortsView(generic.ObjectView): class DeviceRearPortsView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/rearports.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) rearports = RearPort.objects.restrict(request.user, 'view').filter(device=instance).prefetch_related('cable')
rearports = RearPort.objects.restrict(request.user, 'view').filter(device=device).prefetch_related('cable')
rearport_table = tables.DeviceRearPortTable( rearport_table = tables.DeviceRearPortTable(
data=rearports, data=rearports,
user=request.user, user=request.user,
@ -1196,20 +1166,18 @@ class DeviceRearPortsView(generic.ObjectView):
if request.user.has_perm('dcim.change_rearport') or request.user.has_perm('dcim.delete_rearport'): if request.user.has_perm('dcim.change_rearport') or request.user.has_perm('dcim.delete_rearport'):
rearport_table.columns.show('pk') rearport_table.columns.show('pk')
return render(request, 'dcim/device/rearports.html', { return {
'device': device,
'rearport_table': rearport_table, 'rearport_table': rearport_table,
'active_tab': 'rear-ports', 'active_tab': 'rear-ports',
}) }
class DeviceDeviceBaysView(generic.ObjectView): class DeviceDeviceBaysView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/devicebays.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) devicebays = DeviceBay.objects.restrict(request.user, 'view').filter(device=instance).prefetch_related(
devicebays = DeviceBay.objects.restrict(request.user, 'view').filter(device=device).prefetch_related(
'installed_device__device_type__manufacturer', 'installed_device__device_type__manufacturer',
) )
devicebay_table = tables.DeviceDeviceBayTable( devicebay_table = tables.DeviceDeviceBayTable(
@ -1220,21 +1188,19 @@ class DeviceDeviceBaysView(generic.ObjectView):
if request.user.has_perm('dcim.change_devicebay') or request.user.has_perm('dcim.delete_devicebay'): if request.user.has_perm('dcim.change_devicebay') or request.user.has_perm('dcim.delete_devicebay'):
devicebay_table.columns.show('pk') devicebay_table.columns.show('pk')
return render(request, 'dcim/device/devicebays.html', { return {
'device': device,
'devicebay_table': devicebay_table, 'devicebay_table': devicebay_table,
'active_tab': 'device-bays', 'active_tab': 'device-bays',
}) }
class DeviceInventoryView(generic.ObjectView): class DeviceInventoryView(generic.ObjectView):
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/inventory.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk)
inventoryitems = InventoryItem.objects.restrict(request.user, 'view').filter( inventoryitems = InventoryItem.objects.restrict(request.user, 'view').filter(
device=device device=instance
).prefetch_related('manufacturer') ).prefetch_related('manufacturer')
inventoryitem_table = tables.DeviceInventoryItemTable( inventoryitem_table = tables.DeviceInventoryItemTable(
data=inventoryitems, data=inventoryitems,
@ -1244,56 +1210,50 @@ class DeviceInventoryView(generic.ObjectView):
if request.user.has_perm('dcim.change_inventoryitem') or request.user.has_perm('dcim.delete_inventoryitem'): if request.user.has_perm('dcim.change_inventoryitem') or request.user.has_perm('dcim.delete_inventoryitem'):
inventoryitem_table.columns.show('pk') inventoryitem_table.columns.show('pk')
return render(request, 'dcim/device/inventory.html', { return {
'device': device,
'inventoryitem_table': inventoryitem_table, 'inventoryitem_table': inventoryitem_table,
'active_tab': 'inventory', 'active_tab': 'inventory',
}) }
class DeviceStatusView(generic.ObjectView): class DeviceStatusView(generic.ObjectView):
additional_permissions = ['dcim.napalm_read_device'] additional_permissions = ['dcim.napalm_read_device']
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/status.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
device = get_object_or_404(self.queryset, pk=pk) return {
return render(request, 'dcim/device/status.html', {
'device': device,
'active_tab': 'status', 'active_tab': 'status',
}) }
class DeviceLLDPNeighborsView(generic.ObjectView): class DeviceLLDPNeighborsView(generic.ObjectView):
additional_permissions = ['dcim.napalm_read_device'] additional_permissions = ['dcim.napalm_read_device']
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/lldp_neighbors.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
interfaces = instance.vc_interfaces.restrict(request.user, 'view').prefetch_related(
device = get_object_or_404(self.queryset, pk=pk) '_path__destination'
interfaces = device.vc_interfaces.restrict(request.user, 'view').prefetch_related('_path__destination').exclude( ).exclude(
type__in=NONCONNECTABLE_IFACE_TYPES type__in=NONCONNECTABLE_IFACE_TYPES
) )
return render(request, 'dcim/device/lldp_neighbors.html', { return {
'device': device,
'interfaces': interfaces, 'interfaces': interfaces,
'active_tab': 'lldp-neighbors', 'active_tab': 'lldp-neighbors',
}) }
class DeviceConfigView(generic.ObjectView): class DeviceConfigView(generic.ObjectView):
additional_permissions = ['dcim.napalm_read_device'] additional_permissions = ['dcim.napalm_read_device']
queryset = Device.objects.all() queryset = Device.objects.all()
template_name = 'dcim/device/config.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
return {
device = get_object_or_404(self.queryset, pk=pk)
return render(request, 'dcim/device/config.html', {
'device': device,
'active_tab': 'config', 'active_tab': 'config',
}) }
class DeviceConfigContextView(ObjectConfigContextView): class DeviceConfigContextView(ObjectConfigContextView):
@ -1301,6 +1261,10 @@ class DeviceConfigContextView(ObjectConfigContextView):
base_template = 'dcim/device/base.html' base_template = 'dcim/device/base.html'
class DeviceChangeLogView(ObjectChangeLogView):
base_template = 'dcim/device/base.html'
class DeviceEditView(generic.ObjectEditView): class DeviceEditView(generic.ObjectEditView):
queryset = Device.objects.all() queryset = Device.objects.all()
model_form = forms.DeviceForm model_form = forms.DeviceForm
@ -1604,35 +1568,31 @@ class InterfaceListView(generic.ObjectListView):
class InterfaceView(generic.ObjectView): class InterfaceView(generic.ObjectView):
queryset = Interface.objects.all() queryset = Interface.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
interface = get_object_or_404(self.queryset, pk=pk)
# Get assigned IP addresses # Get assigned IP addresses
ipaddress_table = InterfaceIPAddressTable( ipaddress_table = InterfaceIPAddressTable(
data=interface.ip_addresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'), data=instance.ip_addresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'),
orderable=False orderable=False
) )
# Get assigned VLANs and annotate whether each is tagged or untagged # Get assigned VLANs and annotate whether each is tagged or untagged
vlans = [] vlans = []
if interface.untagged_vlan is not None: if instance.untagged_vlan is not None:
vlans.append(interface.untagged_vlan) vlans.append(instance.untagged_vlan)
vlans[0].tagged = False vlans[0].tagged = False
for vlan in interface.tagged_vlans.restrict(request.user).prefetch_related('site', 'group', 'tenant', 'role'): for vlan in instance.tagged_vlans.restrict(request.user).prefetch_related('site', 'group', 'tenant', 'role'):
vlan.tagged = True vlan.tagged = True
vlans.append(vlan) vlans.append(vlan)
vlan_table = InterfaceVLANTable( vlan_table = InterfaceVLANTable(
interface=interface, interface=instance,
data=vlans, data=vlans,
orderable=False orderable=False
) )
return render(request, 'dcim/interface.html', { return {
'instance': interface,
'ipaddress_table': ipaddress_table, 'ipaddress_table': ipaddress_table,
'vlan_table': vlan_table, 'vlan_table': vlan_table,
}) }
class InterfaceCreateView(generic.ComponentCreateView): class InterfaceCreateView(generic.ComponentCreateView):
@ -2093,20 +2053,13 @@ class CableListView(generic.ObjectListView):
class CableView(generic.ObjectView): class CableView(generic.ObjectView):
queryset = Cable.objects.all() queryset = Cable.objects.all()
def get(self, request, pk):
cable = get_object_or_404(self.queryset, pk=pk)
return render(request, 'dcim/cable.html', {
'cable': cable,
})
class PathTraceView(generic.ObjectView): class PathTraceView(generic.ObjectView):
""" """
Trace a cable path beginning from the given path endpoint (origin). Trace a cable path beginning from the given path endpoint (origin).
""" """
additional_permissions = ['dcim.view_cable'] additional_permissions = ['dcim.view_cable']
template_name = 'dcim/cable_trace.html'
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
model = kwargs.pop('model') model = kwargs.pop('model')
@ -2114,13 +2067,12 @@ class PathTraceView(generic.ObjectView):
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)
def get(self, request, pk): def get_extra_context(self, request, instance):
obj = get_object_or_404(self.queryset, pk=pk)
related_paths = [] related_paths = []
# If tracing a PathEndpoint, locate the CablePath (if one exists) by its origin # If tracing a PathEndpoint, locate the CablePath (if one exists) by its origin
if isinstance(obj, PathEndpoint): if isinstance(instance, PathEndpoint):
path = obj._path path = instance._path
# Otherwise, find all CablePaths which traverse the specified object # Otherwise, find all CablePaths which traverse the specified object
else: else:
@ -2135,12 +2087,11 @@ class PathTraceView(generic.ObjectView):
else: else:
path = related_paths.first() path = related_paths.first()
return render(request, 'dcim/cable_trace.html', { return {
'obj': obj,
'path': path, 'path': path,
'related_paths': related_paths, 'related_paths': related_paths,
'total_length': path.get_total_length() if path else None, 'total_length': path.get_total_length() if path else None,
}) }
class CableCreateView(generic.ObjectEditView): class CableCreateView(generic.ObjectEditView):
@ -2347,14 +2298,12 @@ class VirtualChassisListView(generic.ObjectListView):
class VirtualChassisView(generic.ObjectView): class VirtualChassisView(generic.ObjectView):
queryset = VirtualChassis.objects.all() queryset = VirtualChassis.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
virtualchassis = get_object_or_404(self.queryset, pk=pk) members = Device.objects.restrict(request.user).filter(virtual_chassis=instance)
members = Device.objects.restrict(request.user).filter(virtual_chassis=virtualchassis)
return render(request, 'dcim/virtualchassis.html', { return {
'virtualchassis': virtualchassis,
'members': members, 'members': members,
}) }
class VirtualChassisCreateView(generic.ObjectEditView): class VirtualChassisCreateView(generic.ObjectEditView):
@ -2577,20 +2526,17 @@ class PowerPanelListView(generic.ObjectListView):
class PowerPanelView(generic.ObjectView): class PowerPanelView(generic.ObjectView):
queryset = PowerPanel.objects.prefetch_related('site', 'rack_group') queryset = PowerPanel.objects.prefetch_related('site', 'rack_group')
def get(self, request, pk): def get_extra_context(self, request, instance):
power_feeds = PowerFeed.objects.restrict(request.user).filter(power_panel=instance).prefetch_related('rack')
powerpanel = get_object_or_404(self.queryset, pk=pk)
power_feeds = PowerFeed.objects.restrict(request.user).filter(power_panel=powerpanel).prefetch_related('rack')
powerfeed_table = tables.PowerFeedTable( powerfeed_table = tables.PowerFeedTable(
data=power_feeds, data=power_feeds,
orderable=False orderable=False
) )
powerfeed_table.exclude = ['power_panel'] powerfeed_table.exclude = ['power_panel']
return render(request, 'dcim/powerpanel.html', { return {
'powerpanel': powerpanel,
'powerfeed_table': powerfeed_table, 'powerfeed_table': powerfeed_table,
}) }
class PowerPanelEditView(generic.ObjectEditView): class PowerPanelEditView(generic.ObjectEditView):
@ -2640,14 +2586,6 @@ class PowerFeedListView(generic.ObjectListView):
class PowerFeedView(generic.ObjectView): class PowerFeedView(generic.ObjectView):
queryset = PowerFeed.objects.prefetch_related('power_panel', 'rack') queryset = PowerFeed.objects.prefetch_related('power_panel', 'rack')
def get(self, request, pk):
powerfeed = get_object_or_404(self.queryset, pk=pk)
return render(request, 'dcim/powerfeed.html', {
'powerfeed': powerfeed,
})
class PowerFeedEditView(generic.ObjectEditView): class PowerFeedEditView(generic.ObjectEditView):
queryset = PowerFeed.objects.all() queryset = PowerFeed.objects.all()

View File

@ -83,21 +83,7 @@ class ConfigContextListView(generic.ObjectListView):
class ConfigContextView(generic.ObjectView): class ConfigContextView(generic.ObjectView):
queryset = ConfigContext.objects.all() queryset = ConfigContext.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
# Extend queryset to prefetch related objects
self.queryset = self.queryset.prefetch_related(
Prefetch('regions', queryset=Region.objects.restrict(request.user)),
Prefetch('sites', queryset=Site.objects.restrict(request.user)),
Prefetch('roles', queryset=DeviceRole.objects.restrict(request.user)),
Prefetch('platforms', queryset=Platform.objects.restrict(request.user)),
Prefetch('clusters', queryset=Cluster.objects.restrict(request.user)),
Prefetch('cluster_groups', queryset=ClusterGroup.objects.restrict(request.user)),
Prefetch('tenants', queryset=Tenant.objects.restrict(request.user)),
Prefetch('tenant_groups', queryset=TenantGroup.objects.restrict(request.user)),
)
configcontext = get_object_or_404(self.queryset, pk=pk)
# Determine user's preferred output format # Determine user's preferred output format
if request.GET.get('format') in ['json', 'yaml']: if request.GET.get('format') in ['json', 'yaml']:
format = request.GET.get('format') format = request.GET.get('format')
@ -108,10 +94,9 @@ class ConfigContextView(generic.ObjectView):
else: else:
format = 'json' format = 'json'
return render(request, 'extras/configcontext.html', { return {
'configcontext': configcontext,
'format': format, 'format': format,
}) }
class ConfigContextEditView(generic.ObjectEditView): class ConfigContextEditView(generic.ObjectEditView):
@ -138,12 +123,10 @@ class ConfigContextBulkDeleteView(generic.BulkDeleteView):
class ObjectConfigContextView(generic.ObjectView): class ObjectConfigContextView(generic.ObjectView):
base_template = None base_template = None
template_name = 'extras/object_configcontext.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
source_contexts = ConfigContext.objects.restrict(request.user, 'view').get_for_object(instance)
obj = get_object_or_404(self.queryset, pk=pk)
source_contexts = ConfigContext.objects.restrict(request.user, 'view').get_for_object(obj)
model_name = self.queryset.model._meta.model_name
# Determine user's preferred output format # Determine user's preferred output format
if request.GET.get('format') in ['json', 'yaml']: if request.GET.get('format') in ['json', 'yaml']:
@ -155,15 +138,13 @@ class ObjectConfigContextView(generic.ObjectView):
else: else:
format = 'json' format = 'json'
return render(request, 'extras/object_configcontext.html', { return {
model_name: obj, 'rendered_context': instance.get_config_context(),
'obj': obj,
'rendered_context': obj.get_config_context(),
'source_contexts': source_contexts, 'source_contexts': source_contexts,
'format': format, 'format': format,
'base_template': self.base_template, 'base_template': self.base_template,
'active_tab': 'config-context', 'active_tab': 'config-context',
}) }
# #
@ -182,14 +163,11 @@ class ObjectChangeListView(generic.ObjectListView):
class ObjectChangeView(generic.ObjectView): class ObjectChangeView(generic.ObjectView):
queryset = ObjectChange.objects.all() queryset = ObjectChange.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
objectchange = get_object_or_404(self.queryset, pk=pk)
related_changes = ObjectChange.objects.restrict(request.user, 'view').filter( related_changes = ObjectChange.objects.restrict(request.user, 'view').filter(
request_id=objectchange.request_id request_id=instance.request_id
).exclude( ).exclude(
pk=objectchange.pk pk=instance.pk
) )
related_changes_table = tables.ObjectChangeTable( related_changes_table = tables.ObjectChangeTable(
data=related_changes[:50], data=related_changes[:50],
@ -197,39 +175,41 @@ class ObjectChangeView(generic.ObjectView):
) )
objectchanges = ObjectChange.objects.restrict(request.user, 'view').filter( objectchanges = ObjectChange.objects.restrict(request.user, 'view').filter(
changed_object_type=objectchange.changed_object_type, changed_object_type=instance.changed_object_type,
changed_object_id=objectchange.changed_object_id, changed_object_id=instance.changed_object_id,
) )
next_change = objectchanges.filter(time__gt=objectchange.time).order_by('time').first() next_change = objectchanges.filter(time__gt=instance.time).order_by('time').first()
prev_change = objectchanges.filter(time__lt=objectchange.time).order_by('-time').first() prev_change = objectchanges.filter(time__lt=instance.time).order_by('-time').first()
if prev_change: if prev_change:
diff_added = shallow_compare_dict( diff_added = shallow_compare_dict(
prev_change.object_data, prev_change.object_data,
objectchange.object_data, instance.object_data,
exclude=['last_updated'], exclude=['last_updated'],
) )
diff_removed = {x: prev_change.object_data.get(x) for x in diff_added} diff_removed = {x: prev_change.object_data.get(x) for x in diff_added}
else: else:
# No previous change; this is the initial change that added the object # No previous change; this is the initial change that added the object
diff_added = diff_removed = objectchange.object_data diff_added = diff_removed = instance.object_data
return render(request, 'extras/objectchange.html', { return {
'objectchange': objectchange,
'diff_added': diff_added, 'diff_added': diff_added,
'diff_removed': diff_removed, 'diff_removed': diff_removed,
'next_change': next_change, 'next_change': next_change,
'prev_change': prev_change, 'prev_change': prev_change,
'related_changes_table': related_changes_table, 'related_changes_table': related_changes_table,
'related_changes_count': related_changes.count() 'related_changes_count': related_changes.count()
}) }
class ObjectChangeLogView(View): class ObjectChangeLogView(View):
""" """
Present a history of changes made to a particular object. Present a history of changes made to a particular object.
base_template: The name of the template to extend. If not provided, "<app>/<model>.html" will be used.
""" """
base_template = None
def get(self, request, model, **kwargs): def get(self, request, model, **kwargs):
@ -259,20 +239,20 @@ class ObjectChangeLogView(View):
} }
RequestConfig(request, paginate).configure(objectchanges_table) RequestConfig(request, paginate).configure(objectchanges_table)
# Check whether a header template exists for this model # Default to using "<app>/<model>.html" as the template, if it exists. Otherwise,
base_template = '{}/{}.html'.format(model._meta.app_label, model._meta.model_name) # fall back to using base.html.
if self.base_template is None:
self.base_template = f"{model._meta.app_label}/{model._meta.model_name}.html"
# TODO: This can be removed once an object view has been established for every model.
try: try:
template.loader.get_template(base_template) template.loader.get_template(self.base_template)
object_var = model._meta.model_name
except template.TemplateDoesNotExist: except template.TemplateDoesNotExist:
base_template = 'base.html' self.base_template = 'base.html'
object_var = 'obj'
return render(request, 'extras/object_changelog.html', { return render(request, 'extras/object_changelog.html', {
object_var: obj, 'object': obj,
'instance': obj, # We'll eventually standardize on 'instance` for the object variable name
'table': objectchanges_table, 'table': objectchanges_table,
'base_template': base_template, 'base_template': self.base_template,
'active_tab': 'changelog', 'active_tab': 'changelog',
}) })

View File

@ -28,26 +28,23 @@ class VRFListView(generic.ObjectListView):
class VRFView(generic.ObjectView): class VRFView(generic.ObjectView):
queryset = VRF.objects.all() queryset = VRF.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
prefix_count = Prefix.objects.restrict(request.user, 'view').filter(vrf=instance).count()
vrf = get_object_or_404(self.queryset, pk=pk)
prefix_count = Prefix.objects.restrict(request.user, 'view').filter(vrf=vrf).count()
import_targets_table = tables.RouteTargetTable( import_targets_table = tables.RouteTargetTable(
vrf.import_targets.prefetch_related('tenant'), instance.import_targets.prefetch_related('tenant'),
orderable=False orderable=False
) )
export_targets_table = tables.RouteTargetTable( export_targets_table = tables.RouteTargetTable(
vrf.export_targets.prefetch_related('tenant'), instance.export_targets.prefetch_related('tenant'),
orderable=False orderable=False
) )
return render(request, 'ipam/vrf.html', { return {
'vrf': vrf,
'prefix_count': prefix_count, 'prefix_count': prefix_count,
'import_targets_table': import_targets_table, 'import_targets_table': import_targets_table,
'export_targets_table': export_targets_table, 'export_targets_table': export_targets_table,
}) }
class VRFEditView(generic.ObjectEditView): class VRFEditView(generic.ObjectEditView):
@ -93,23 +90,20 @@ class RouteTargetListView(generic.ObjectListView):
class RouteTargetView(generic.ObjectView): class RouteTargetView(generic.ObjectView):
queryset = RouteTarget.objects.all() queryset = RouteTarget.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
routetarget = get_object_or_404(self.queryset, pk=pk)
importing_vrfs_table = tables.VRFTable( importing_vrfs_table = tables.VRFTable(
routetarget.importing_vrfs.prefetch_related('tenant'), instance.importing_vrfs.prefetch_related('tenant'),
orderable=False orderable=False
) )
exporting_vrfs_table = tables.VRFTable( exporting_vrfs_table = tables.VRFTable(
routetarget.exporting_vrfs.prefetch_related('tenant'), instance.exporting_vrfs.prefetch_related('tenant'),
orderable=False orderable=False
) )
return render(request, 'ipam/routetarget.html', { return {
'routetarget': routetarget,
'importing_vrfs_table': importing_vrfs_table, 'importing_vrfs_table': importing_vrfs_table,
'exporting_vrfs_table': exporting_vrfs_table, 'exporting_vrfs_table': exporting_vrfs_table,
}) }
class RouteTargetEditView(generic.ObjectEditView): class RouteTargetEditView(generic.ObjectEditView):
@ -206,13 +200,10 @@ class AggregateListView(generic.ObjectListView):
class AggregateView(generic.ObjectView): class AggregateView(generic.ObjectView):
queryset = Aggregate.objects.all() queryset = Aggregate.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
aggregate = get_object_or_404(self.queryset, pk=pk)
# Find all child prefixes contained by this aggregate # Find all child prefixes contained by this aggregate
child_prefixes = Prefix.objects.restrict(request.user, 'view').filter( child_prefixes = Prefix.objects.restrict(request.user, 'view').filter(
prefix__net_contained_or_equal=str(aggregate.prefix) prefix__net_contained_or_equal=str(instance.prefix)
).prefetch_related( ).prefetch_related(
'site', 'role' 'site', 'role'
).order_by( ).order_by(
@ -221,7 +212,7 @@ class AggregateView(generic.ObjectView):
# Add available prefixes to the table if requested # Add available prefixes to the table if requested
if request.GET.get('show_available', 'true') == 'true': if request.GET.get('show_available', 'true') == 'true':
child_prefixes = add_available_prefixes(aggregate.prefix, child_prefixes) child_prefixes = add_available_prefixes(instance.prefix, child_prefixes)
prefix_table = tables.PrefixDetailTable(child_prefixes) prefix_table = tables.PrefixDetailTable(child_prefixes)
if request.user.has_perm('ipam.change_prefix') or request.user.has_perm('ipam.delete_prefix'): if request.user.has_perm('ipam.change_prefix') or request.user.has_perm('ipam.delete_prefix'):
@ -240,12 +231,11 @@ class AggregateView(generic.ObjectView):
'delete': request.user.has_perm('ipam.delete_prefix'), 'delete': request.user.has_perm('ipam.delete_prefix'),
} }
return render(request, 'ipam/aggregate.html', { return {
'aggregate': aggregate,
'prefix_table': prefix_table, 'prefix_table': prefix_table,
'permissions': permissions, 'permissions': permissions,
'show_available': request.GET.get('show_available', 'true') == 'true', 'show_available': request.GET.get('show_available', 'true') == 'true',
}) }
class AggregateEditView(generic.ObjectEditView): class AggregateEditView(generic.ObjectEditView):
@ -324,22 +314,19 @@ class PrefixListView(generic.ObjectListView):
class PrefixView(generic.ObjectView): class PrefixView(generic.ObjectView):
queryset = Prefix.objects.prefetch_related('vrf', 'site__region', 'tenant__group', 'vlan__group', 'role') queryset = Prefix.objects.prefetch_related('vrf', 'site__region', 'tenant__group', 'vlan__group', 'role')
def get(self, request, pk): def get_extra_context(self, request, instance):
prefix = get_object_or_404(self.queryset, pk=pk)
try: try:
aggregate = Aggregate.objects.restrict(request.user, 'view').get( aggregate = Aggregate.objects.restrict(request.user, 'view').get(
prefix__net_contains_or_equals=str(prefix.prefix) prefix__net_contains_or_equals=str(instance.prefix)
) )
except Aggregate.DoesNotExist: except Aggregate.DoesNotExist:
aggregate = None aggregate = None
# Parent prefixes table # Parent prefixes table
parent_prefixes = Prefix.objects.restrict(request.user, 'view').filter( parent_prefixes = Prefix.objects.restrict(request.user, 'view').filter(
Q(vrf=prefix.vrf) | Q(vrf__isnull=True) Q(vrf=instance.vrf) | Q(vrf__isnull=True)
).filter( ).filter(
prefix__net_contains=str(prefix.prefix) prefix__net_contains=str(instance.prefix)
).prefetch_related( ).prefetch_related(
'site', 'role' 'site', 'role'
).annotate_tree() ).annotate_tree()
@ -348,38 +335,35 @@ class PrefixView(generic.ObjectView):
# Duplicate prefixes table # Duplicate prefixes table
duplicate_prefixes = Prefix.objects.restrict(request.user, 'view').filter( duplicate_prefixes = Prefix.objects.restrict(request.user, 'view').filter(
vrf=prefix.vrf, prefix=str(prefix.prefix) vrf=instance.vrf, prefix=str(instance.prefix)
).exclude( ).exclude(
pk=prefix.pk pk=instance.pk
).prefetch_related( ).prefetch_related(
'site', 'role' 'site', 'role'
) )
duplicate_prefix_table = tables.PrefixTable(list(duplicate_prefixes), orderable=False) duplicate_prefix_table = tables.PrefixTable(list(duplicate_prefixes), orderable=False)
duplicate_prefix_table.exclude = ('vrf',) duplicate_prefix_table.exclude = ('vrf',)
return render(request, 'ipam/prefix.html', { return {
'prefix': prefix,
'aggregate': aggregate, 'aggregate': aggregate,
'parent_prefix_table': parent_prefix_table, 'parent_prefix_table': parent_prefix_table,
'duplicate_prefix_table': duplicate_prefix_table, 'duplicate_prefix_table': duplicate_prefix_table,
}) }
class PrefixPrefixesView(generic.ObjectView): class PrefixPrefixesView(generic.ObjectView):
queryset = Prefix.objects.all() queryset = Prefix.objects.all()
template_name = 'ipam/prefix_prefixes.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
prefix = get_object_or_404(self.queryset, pk=pk)
# Child prefixes table # Child prefixes table
child_prefixes = prefix.get_child_prefixes().restrict(request.user, 'view').prefetch_related( child_prefixes = instance.get_child_prefixes().restrict(request.user, 'view').prefetch_related(
'site', 'vlan', 'role', 'site', 'vlan', 'role',
).annotate_tree() ).annotate_tree()
# Add available prefixes to the table if requested # Add available prefixes to the table if requested
if child_prefixes and request.GET.get('show_available', 'true') == 'true': if child_prefixes and request.GET.get('show_available', 'true') == 'true':
child_prefixes = add_available_prefixes(prefix.prefix, child_prefixes) child_prefixes = add_available_prefixes(instance.prefix, child_prefixes)
prefix_table = tables.PrefixDetailTable(child_prefixes) prefix_table = tables.PrefixDetailTable(child_prefixes)
if request.user.has_perm('ipam.change_prefix') or request.user.has_perm('ipam.delete_prefix'): if request.user.has_perm('ipam.change_prefix') or request.user.has_perm('ipam.delete_prefix'):
@ -398,32 +382,31 @@ class PrefixPrefixesView(generic.ObjectView):
'delete': request.user.has_perm('ipam.delete_prefix'), 'delete': request.user.has_perm('ipam.delete_prefix'),
} }
return render(request, 'ipam/prefix_prefixes.html', { bulk_querystring = 'vrf_id={}&within={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)
'prefix': prefix,
'first_available_prefix': prefix.get_first_available_prefix(), return {
'first_available_prefix': instance.get_first_available_prefix(),
'prefix_table': prefix_table, 'prefix_table': prefix_table,
'permissions': permissions, 'permissions': permissions,
'bulk_querystring': 'vrf_id={}&within={}'.format(prefix.vrf.pk if prefix.vrf else '0', prefix.prefix), 'bulk_querystring': bulk_querystring,
'active_tab': 'prefixes', 'active_tab': 'prefixes',
'show_available': request.GET.get('show_available', 'true') == 'true', 'show_available': request.GET.get('show_available', 'true') == 'true',
}) }
class PrefixIPAddressesView(generic.ObjectView): class PrefixIPAddressesView(generic.ObjectView):
queryset = Prefix.objects.all() queryset = Prefix.objects.all()
template_name = 'ipam/prefix_ipaddresses.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
prefix = get_object_or_404(self.queryset, pk=pk)
# Find all IPAddresses belonging to this Prefix # Find all IPAddresses belonging to this Prefix
ipaddresses = prefix.get_child_ips().restrict(request.user, 'view').prefetch_related( ipaddresses = instance.get_child_ips().restrict(request.user, 'view').prefetch_related(
'vrf', 'primary_ip4_for', 'primary_ip6_for' 'vrf', 'primary_ip4_for', 'primary_ip6_for'
) )
# Add available IP addresses to the table if requested # Add available IP addresses to the table if requested
if request.GET.get('show_available', 'true') == 'true': if request.GET.get('show_available', 'true') == 'true':
ipaddresses = add_available_ipaddresses(prefix.prefix, ipaddresses, prefix.is_pool) ipaddresses = add_available_ipaddresses(instance.prefix, ipaddresses, instance.is_pool)
ip_table = tables.IPAddressTable(ipaddresses) ip_table = tables.IPAddressTable(ipaddresses)
if request.user.has_perm('ipam.change_ipaddress') or request.user.has_perm('ipam.delete_ipaddress'): if request.user.has_perm('ipam.change_ipaddress') or request.user.has_perm('ipam.delete_ipaddress'):
@ -442,15 +425,16 @@ class PrefixIPAddressesView(generic.ObjectView):
'delete': request.user.has_perm('ipam.delete_ipaddress'), 'delete': request.user.has_perm('ipam.delete_ipaddress'),
} }
return render(request, 'ipam/prefix_ipaddresses.html', { bulk_querystring = 'vrf_id={}&parent={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)
'prefix': prefix,
'first_available_ip': prefix.get_first_available_ip(), return {
'first_available_ip': instance.get_first_available_ip(),
'ip_table': ip_table, 'ip_table': ip_table,
'permissions': permissions, 'permissions': permissions,
'bulk_querystring': 'vrf_id={}&parent={}'.format(prefix.vrf.pk if prefix.vrf else '0', prefix.prefix), 'bulk_querystring': bulk_querystring,
'active_tab': 'ip-addresses', 'active_tab': 'ip-addresses',
'show_available': request.GET.get('show_available', 'true') == 'true', 'show_available': request.GET.get('show_available', 'true') == 'true',
}) }
class PrefixEditView(generic.ObjectEditView): class PrefixEditView(generic.ObjectEditView):
@ -497,13 +481,11 @@ class IPAddressListView(generic.ObjectListView):
class IPAddressView(generic.ObjectView): class IPAddressView(generic.ObjectView):
queryset = IPAddress.objects.prefetch_related('vrf__tenant', 'tenant') queryset = IPAddress.objects.prefetch_related('vrf__tenant', 'tenant')
def get(self, request, pk): def get_extra_context(self, request, instance):
ipaddress = get_object_or_404(self.queryset, pk=pk)
# Parent prefixes table # Parent prefixes table
parent_prefixes = Prefix.objects.restrict(request.user, 'view').filter( parent_prefixes = Prefix.objects.restrict(request.user, 'view').filter(
vrf=ipaddress.vrf, prefix__net_contains=str(ipaddress.address.ip) vrf=instance.vrf,
prefix__net_contains=str(instance.address.ip)
).prefetch_related( ).prefetch_related(
'site', 'role' 'site', 'role'
) )
@ -512,23 +494,24 @@ class IPAddressView(generic.ObjectView):
# Duplicate IPs table # Duplicate IPs table
duplicate_ips = IPAddress.objects.restrict(request.user, 'view').filter( duplicate_ips = IPAddress.objects.restrict(request.user, 'view').filter(
vrf=ipaddress.vrf, address=str(ipaddress.address) vrf=instance.vrf,
address=str(instance.address)
).exclude( ).exclude(
pk=ipaddress.pk pk=instance.pk
).prefetch_related( ).prefetch_related(
'nat_inside' 'nat_inside'
) )
# Exclude anycast IPs if this IP is anycast # Exclude anycast IPs if this IP is anycast
if ipaddress.role == IPAddressRoleChoices.ROLE_ANYCAST: if instance.role == IPAddressRoleChoices.ROLE_ANYCAST:
duplicate_ips = duplicate_ips.exclude(role=IPAddressRoleChoices.ROLE_ANYCAST) duplicate_ips = duplicate_ips.exclude(role=IPAddressRoleChoices.ROLE_ANYCAST)
# Limit to a maximum of 10 duplicates displayed here # Limit to a maximum of 10 duplicates displayed here
duplicate_ips_table = tables.IPAddressTable(duplicate_ips[:10], orderable=False) duplicate_ips_table = tables.IPAddressTable(duplicate_ips[:10], orderable=False)
# Related IP table # Related IP table
related_ips = IPAddress.objects.restrict(request.user, 'view').exclude( related_ips = IPAddress.objects.restrict(request.user, 'view').exclude(
address=str(ipaddress.address) address=str(instance.address)
).filter( ).filter(
vrf=ipaddress.vrf, address__net_contained_or_equal=str(ipaddress.address) vrf=instance.vrf, address__net_contained_or_equal=str(instance.address)
) )
related_ips_table = tables.IPAddressTable(related_ips, orderable=False) related_ips_table = tables.IPAddressTable(related_ips, orderable=False)
@ -538,13 +521,12 @@ class IPAddressView(generic.ObjectView):
} }
RequestConfig(request, paginate).configure(related_ips_table) RequestConfig(request, paginate).configure(related_ips_table)
return render(request, 'ipam/ipaddress.html', { return {
'ipaddress': ipaddress,
'parent_prefixes_table': parent_prefixes_table, 'parent_prefixes_table': parent_prefixes_table,
'duplicate_ips_table': duplicate_ips_table, 'duplicate_ips_table': duplicate_ips_table,
'more_duplicate_ips': duplicate_ips.count() > 10, 'more_duplicate_ips': duplicate_ips.count() > 10,
'related_ips_table': related_ips_table, 'related_ips_table': related_ips_table,
}) }
class IPAddressEditView(generic.ObjectEditView): class IPAddressEditView(generic.ObjectEditView):
@ -569,6 +551,7 @@ class IPAddressEditView(generic.ObjectEditView):
return obj return obj
# TODO: Standardize or remove this view
class IPAddressAssignView(generic.ObjectView): class IPAddressAssignView(generic.ObjectView):
""" """
Search for IPAddresses to be assigned to an Interface. Search for IPAddresses to be assigned to an Interface.
@ -678,14 +661,13 @@ class VLANGroupBulkDeleteView(generic.BulkDeleteView):
class VLANGroupVLANsView(generic.ObjectView): class VLANGroupVLANsView(generic.ObjectView):
queryset = VLANGroup.objects.all() queryset = VLANGroup.objects.all()
template_name = 'ipam/vlangroup_vlans.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
vlan_group = get_object_or_404(self.queryset, pk=pk) vlans = VLAN.objects.restrict(request.user, 'view').filter(group=instance).prefetch_related(
vlans = VLAN.objects.restrict(request.user, 'view').filter(group_id=pk).prefetch_related(
Prefetch('prefixes', queryset=Prefix.objects.restrict(request.user)) Prefetch('prefixes', queryset=Prefix.objects.restrict(request.user))
) )
vlans = add_available_vlans(vlan_group, vlans) vlans = add_available_vlans(instance, vlans)
vlan_table = tables.VLANDetailTable(vlans) vlan_table = tables.VLANDetailTable(vlans)
if request.user.has_perm('ipam.change_vlan') or request.user.has_perm('ipam.delete_vlan'): if request.user.has_perm('ipam.change_vlan') or request.user.has_perm('ipam.delete_vlan'):
@ -706,13 +688,12 @@ class VLANGroupVLANsView(generic.ObjectView):
'delete': request.user.has_perm('ipam.delete_vlan'), 'delete': request.user.has_perm('ipam.delete_vlan'),
} }
return render(request, 'ipam/vlangroup_vlans.html', { return {
'vlan_group': vlan_group, 'first_available_vlan': instance.get_next_available_vid(),
'first_available_vlan': vlan_group.get_next_available_vid(), 'bulk_querystring': f'group_id={instance.pk}',
'bulk_querystring': 'group_id={}'.format(vlan_group.pk),
'vlan_table': vlan_table, 'vlan_table': vlan_table,
'permissions': permissions, 'permissions': permissions,
}) }
# #
@ -729,27 +710,24 @@ class VLANListView(generic.ObjectListView):
class VLANView(generic.ObjectView): class VLANView(generic.ObjectView):
queryset = VLAN.objects.prefetch_related('site__region', 'tenant__group', 'role') queryset = VLAN.objects.prefetch_related('site__region', 'tenant__group', 'role')
def get(self, request, pk): def get_extra_context(self, request, instance):
prefixes = Prefix.objects.restrict(request.user, 'view').filter(vlan=instance).prefetch_related(
vlan = get_object_or_404(self.queryset, pk=pk)
prefixes = Prefix.objects.restrict(request.user, 'view').filter(vlan=vlan).prefetch_related(
'vrf', 'site', 'role' 'vrf', 'site', 'role'
) )
prefix_table = tables.PrefixTable(list(prefixes), orderable=False) prefix_table = tables.PrefixTable(list(prefixes), orderable=False)
prefix_table.exclude = ('vlan',) prefix_table.exclude = ('vlan',)
return render(request, 'ipam/vlan.html', { return {
'vlan': vlan,
'prefix_table': prefix_table, 'prefix_table': prefix_table,
}) }
class VLANInterfacesView(generic.ObjectView): class VLANInterfacesView(generic.ObjectView):
queryset = VLAN.objects.all() queryset = VLAN.objects.all()
template_name = 'ipam/vlan_interfaces.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
vlan = get_object_or_404(self.queryset, pk=pk) interfaces = instance.get_interfaces().prefetch_related('device')
interfaces = vlan.get_interfaces().prefetch_related('device')
members_table = tables.VLANDevicesTable(interfaces) members_table = tables.VLANDevicesTable(interfaces)
paginate = { paginate = {
@ -758,19 +736,18 @@ class VLANInterfacesView(generic.ObjectView):
} }
RequestConfig(request, paginate).configure(members_table) RequestConfig(request, paginate).configure(members_table)
return render(request, 'ipam/vlan_interfaces.html', { return {
'vlan': vlan,
'members_table': members_table, 'members_table': members_table,
'active_tab': 'interfaces', 'active_tab': 'interfaces',
}) }
class VLANVMInterfacesView(generic.ObjectView): class VLANVMInterfacesView(generic.ObjectView):
queryset = VLAN.objects.all() queryset = VLAN.objects.all()
template_name = 'ipam/vlan_vminterfaces.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
vlan = get_object_or_404(self.queryset, pk=pk) interfaces = instance.get_vminterfaces().prefetch_related('virtual_machine')
interfaces = vlan.get_vminterfaces().prefetch_related('virtual_machine')
members_table = tables.VLANVirtualMachinesTable(interfaces) members_table = tables.VLANVirtualMachinesTable(interfaces)
paginate = { paginate = {
@ -779,11 +756,10 @@ class VLANVMInterfacesView(generic.ObjectView):
} }
RequestConfig(request, paginate).configure(members_table) RequestConfig(request, paginate).configure(members_table)
return render(request, 'ipam/vlan_vminterfaces.html', { return {
'vlan': vlan,
'members_table': members_table, 'members_table': members_table,
'active_tab': 'vminterfaces', 'active_tab': 'vminterfaces',
}) }
class VLANEditView(generic.ObjectEditView): class VLANEditView(generic.ObjectEditView):
@ -830,14 +806,6 @@ class ServiceListView(generic.ObjectListView):
class ServiceView(generic.ObjectView): class ServiceView(generic.ObjectView):
queryset = Service.objects.prefetch_related('ipaddresses') queryset = Service.objects.prefetch_related('ipaddresses')
def get(self, request, pk):
service = get_object_or_404(self.queryset, pk=pk)
return render(request, 'ipam/service.html', {
'service': service,
})
class ServiceEditView(generic.ObjectEditView): class ServiceEditView(generic.ObjectEditView):
queryset = Service.objects.prefetch_related('ipaddresses') queryset = Service.objects.prefetch_related('ipaddresses')

View File

@ -32,9 +32,11 @@ class ObjectView(ObjectPermissionRequiredMixin, View):
""" """
Retrieve a single object for display. Retrieve a single object for display.
queryset: The base queryset for retrieving the object. queryset: The base queryset for retrieving the object
template_name: Name of the template to use
""" """
queryset = None queryset = None
template_name = None
def get_required_permission(self): def get_required_permission(self):
return get_permission_for_model(self.queryset.model, 'view') return get_permission_for_model(self.queryset.model, 'view')
@ -43,19 +45,29 @@ class ObjectView(ObjectPermissionRequiredMixin, View):
""" """
Return self.template_name if set. Otherwise, resolve the template path by model app_label and name. Return self.template_name if set. Otherwise, resolve the template path by model app_label and name.
""" """
if hasattr(self, 'template_name'): if self.template_name is not None:
return self.template_name return self.template_name
model_opts = self.queryset.model._meta model_opts = self.queryset.model._meta
return f'{model_opts.app_label}/{model_opts.model_name}.html' return f'{model_opts.app_label}/{model_opts.model_name}.html'
def get(self, request, pk): def get_extra_context(self, request, instance):
""" """
Generic GET handler for accessing an object by PK Return any additional context data for the template.
request: The current request
instance: The object being viewed
""" """
instance = get_object_or_404(self.queryset, pk=pk) return {}
def get(self, request, *args, **kwargs):
"""
Generic GET handler for accessing an object by PK or slug
"""
instance = get_object_or_404(self.queryset, **kwargs)
return render(request, self.get_template_name(), { return render(request, self.get_template_name(), {
'instance': instance, 'object': instance,
**self.get_extra_context(request, instance),
}) })

View File

@ -66,14 +66,6 @@ class SecretListView(generic.ObjectListView):
class SecretView(generic.ObjectView): class SecretView(generic.ObjectView):
queryset = Secret.objects.all() queryset = Secret.objects.all()
def get(self, request, pk):
secret = get_object_or_404(self.queryset, pk=pk)
return render(request, 'secrets/secret.html', {
'secret': secret,
})
class SecretEditView(generic.ObjectEditView): class SecretEditView(generic.ObjectEditView):
queryset = Secret.objects.all() queryset = Secret.objects.all()

View File

@ -4,15 +4,15 @@
{% load helpers %} {% load helpers %}
{% load plugins %} {% load plugins %}
{% block title %}{{ circuit }}{% endblock %} {% block title %}{{ object }}{% endblock %}
{% block header %} {% block header %}
<div class="row noprint"> <div class="row noprint">
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'circuits:circuit_list' %}">Circuits</a></li> <li><a href="{% url 'circuits:circuit_list' %}">Circuits</a></li>
<li><a href="{% url 'circuits:circuit_list' %}?provider={{ circuit.provider.slug }}">{{ circuit.provider }}</a></li> <li><a href="{% url 'circuits:circuit_list' %}?provider={{ object.provider.slug }}">{{ object.provider }}</a></li>
<li>{{ circuit.cid }}</li> <li>{{ object.cid }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -29,29 +29,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons circuit %} {% plugin_buttons object %}
{% if perms.circuits.add_circuit %} {% if perms.circuits.add_circuit %}
{% clone_button circuit %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.circuits.change_circuit %} {% if perms.circuits.change_circuit %}
{% edit_button circuit %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.circuits.delete_circuit %} {% if perms.circuits.delete_circuit %}
{% delete_button circuit %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{{ circuit }}</h1> <h1>{{ object }}</h1>
{% include 'inc/created_updated.html' with obj=circuit %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links circuit %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ circuit.get_absolute_url }}">Circuit</a> <a href="{{ object.get_absolute_url }}">Circuit</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'circuits:circuit_changelog' pk=circuit.pk %}">Change Log</a> <a href="{% url 'circuits:circuit_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -68,31 +68,31 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ circuit.get_status_class }}">{{ circuit.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Provider</td> <td>Provider</td>
<td> <td>
<a href="{% url 'circuits:provider' slug=circuit.provider.slug %}">{{ circuit.provider }}</a> <a href="{% url 'circuits:provider' slug=object.provider.slug %}">{{ object.provider }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Circuit ID</td> <td>Circuit ID</td>
<td>{{ circuit.cid }}</td> <td>{{ object.cid }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td><a href="{{ circuit.type.get_absolute_url }}">{{ circuit.type }}</a></td> <td><a href="{{ object.type.get_absolute_url }}">{{ object.type }}</a></td>
</tr> </tr>
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if circuit.tenant %} {% if object.tenant %}
{% if circuit.tenant.group %} {% if object.tenant.group %}
<a href="{{ circuit.tenant.group.get_absolute_url }}">{{ circuit.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ circuit.tenant.get_absolute_url }}">{{ circuit.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -100,43 +100,43 @@
</tr> </tr>
<tr> <tr>
<td>Install Date</td> <td>Install Date</td>
<td>{{ circuit.install_date|placeholder }}</td> <td>{{ object.install_date|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Commit Rate</td> <td>Commit Rate</td>
<td>{{ circuit.commit_rate|humanize_speed|placeholder }}</td> <td>{{ object.commit_rate|humanize_speed|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ circuit.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=circuit %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=circuit.tags.all url='circuits:circuit_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:circuit_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if circuit.comments %} {% if object.comments %}
{{ circuit.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_left_page circuit %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'circuits/inc/circuit_termination.html' with termination=termination_a side='A' %} {% include 'circuits/inc/circuit_termination.html' with termination=termination_a side='A' %}
{% include 'circuits/inc/circuit_termination.html' with termination=termination_z side='Z' %} {% include 'circuits/inc/circuit_termination.html' with termination=termination_z side='Z' %}
{% plugin_right_page circuit %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page circuit %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -4,7 +4,7 @@
<div class="panel-heading"> <div class="panel-heading">
<div class="pull-right"> <div class="pull-right">
{% if not termination and perms.circuits.add_circuittermination %} {% if not termination and perms.circuits.add_circuittermination %}
<a href="{% url 'circuits:circuittermination_add' circuit=circuit.pk %}?term_side={{ side }}" class="btn btn-xs btn-success"> <a href="{% url 'circuits:circuittermination_add' circuit=object.pk %}?term_side={{ side }}" class="btn btn-xs btn-success">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add
</a> </a>
{% endif %} {% endif %}
@ -12,12 +12,12 @@
<a href="{% url 'circuits:circuittermination_edit' pk=termination.pk %}" class="btn btn-xs btn-warning"> <a href="{% url 'circuits:circuittermination_edit' pk=termination.pk %}" class="btn btn-xs btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</a> </a>
<a href="{% url 'circuits:circuit_terminations_swap' pk=circuit.pk %}" class="btn btn-xs btn-primary"> <a href="{% url 'circuits:circuit_terminations_swap' pk=object.pk %}" class="btn btn-xs btn-primary">
<span class="mdi mdi-swap-vertical" aria-hidden="true"></span> Swap <span class="mdi mdi-swap-vertical" aria-hidden="true"></span> Swap
</a> </a>
{% endif %} {% endif %}
{% if termination and perms.circuits.delete_circuittermination %} {% if termination and perms.circuits.delete_circuittermination %}
<a href="{% url 'circuits:circuittermination_delete' pk=termination.pk %}?return_url={{ circuit.get_absolute_url }}" class="btn btn-xs btn-danger"> <a href="{% url 'circuits:circuittermination_delete' pk=termination.pk %}?return_url={{ object.get_absolute_url }}" class="btn btn-xs btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</a> </a>
{% endif %} {% endif %}
@ -67,10 +67,10 @@
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='interface' %}?termination_b_site={{ termination.site.pk }}&return_url={{ circuit.get_absolute_url }}">Interface</a></li> <li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='interface' %}?termination_b_site={{ termination.site.pk }}&return_url={{ object.get_absolute_url }}">Interface</a></li>
<li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='front-port' %}?termination_b_site={{ termination.site.pk }}&return_url={{ circuit.get_absolute_url }}">Front Port</a></li> <li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='front-port' %}?termination_b_site={{ termination.site.pk }}&return_url={{ object.get_absolute_url }}">Front Port</a></li>
<li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='rear-port' %}?termination_b_site={{ termination.site.pk }}&return_url={{ circuit.get_absolute_url }}">Rear Port</a></li> <li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='rear-port' %}?termination_b_site={{ termination.site.pk }}&return_url={{ object.get_absolute_url }}">Rear Port</a></li>
<li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='circuit-termination' %}?termination_b_site={{ termination.site.pk }}&return_url={{ circuit.get_absolute_url }}">Circuit Termination</a></li> <li><a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk termination_b_type='circuit-termination' %}?termination_b_site={{ termination.site.pk }}&return_url={{ object.get_absolute_url }}">Circuit Termination</a></li>
</ul> </ul>
</span> </span>
</div> </div>

View File

@ -5,14 +5,14 @@
{% load helpers %} {% load helpers %}
{% load plugins %} {% load plugins %}
{% block title %}{{ provider }}{% endblock %} {% block title %}{{ object }}{% endblock %}
{% block header %} {% block header %}
<div class="row noprint"> <div class="row noprint">
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'circuits:provider_list' %}">Providers</a></li> <li><a href="{% url 'circuits:provider_list' %}">Providers</a></li>
<li>{{ provider }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -29,29 +29,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons provider %} {% plugin_buttons object %}
{% if perms.circuits.add_provider %} {% if perms.circuits.add_provider %}
{% clone_button provider %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.circuits.change_provider %} {% if perms.circuits.change_provider %}
{% edit_button provider %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.circuits.delete_provider %} {% if perms.circuits.delete_provider %}
{% delete_button provider %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{{ provider }}</h1> <h1>{{ object }}</h1>
{% include 'inc/created_updated.html' with obj=provider %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links provider %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ provider.get_absolute_url }}">Provider</a> <a href="{{ object.get_absolute_url }}">Provider</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'circuits:provider_changelog' slug=provider.slug %}">Change Log</a> <a href="{% url 'circuits:provider_changelog' slug=object.slug %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -67,17 +67,17 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>ASN</td> <td>ASN</td>
<td>{{ provider.asn|placeholder }}</td> <td>{{ object.asn|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Account</td> <td>Account</td>
<td>{{ provider.account|placeholder }}</td> <td>{{ object.account|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Customer Portal</td> <td>Customer Portal</td>
<td> <td>
{% if provider.portal_url %} {% if object.portal_url %}
<a href="{{ provider.portal_url }}">{{ provider.portal_url }}</a> <a href="{{ object.portal_url }}">{{ object.portal_url }}</a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -85,35 +85,35 @@
</tr> </tr>
<tr> <tr>
<td>NOC Contact</td> <td>NOC Contact</td>
<td class="rendered-markdown">{{ provider.noc_contact|render_markdown|placeholder }}</td> <td class="rendered-markdown">{{ object.noc_contact|render_markdown|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Admin Contact</td> <td>Admin Contact</td>
<td class="rendered-markdown">{{ provider.admin_contact|render_markdown|placeholder }}</td> <td class="rendered-markdown">{{ object.admin_contact|render_markdown|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Circuits</td> <td>Circuits</td>
<td> <td>
<a href="{% url 'circuits:circuit_list' %}?provider={{ provider.slug }}">{{ circuits_table.rows|length }}</a> <a href="{% url 'circuits:circuit_list' %}?provider={{ object.slug }}">{{ circuits_table.rows|length }}</a>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=provider %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=provider.tags.all url='circuits:provider_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:object_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if provider.comments %} {% if object.comments %}
{{ provider.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_left_page provider %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<div class="panel panel-default"> <div class="panel panel-default">
@ -123,19 +123,19 @@
{% include 'inc/table.html' with table=circuits_table %} {% include 'inc/table.html' with table=circuits_table %}
{% if perms.circuits.add_circuit %} {% if perms.circuits.add_circuit %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'circuits:circuit_add' %}?provider={{ provider.pk }}" class="btn btn-xs btn-primary"> <a href="{% url 'circuits:circuit_add' %}?provider={{ object.pk }}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add circuit <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add circuit
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %} {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %}
{% plugin_right_page provider %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page provider %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,31 +9,31 @@
<div class="col-md-12"> <div class="col-md-12">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:cable_list' %}">Cables</a></li> <li><a href="{% url 'dcim:cable_list' %}">Cables</a></li>
<li>{{ cable }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons cable %} {% plugin_buttons object %}
{% if perms.dcim.change_cable %} {% if perms.dcim.change_cable %}
{% edit_button cable %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_cable %} {% if perms.dcim.delete_cable %}
{% delete_button cable %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}Cable {{ cable }}{% endblock %}</h1> <h1>{% block title %}Cable {{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=cable %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links cable %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ cable.get_absolute_url }}">Cable</a> <a href="{{ object.get_absolute_url }}">Cable</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:cable_changelog' pk=cable.pk %}">Change Log</a> <a href="{% url 'dcim:cable_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -49,23 +49,23 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ cable.get_type_display|placeholder }}</td> <td>{{ object.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ cable.get_status_class }}">{{ cable.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ cable.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Color</td> <td>Color</td>
<td> <td>
{% if cable.color %} {% if object.color %}
<span class="label color-block" style="background-color: #{{ cable.color }}">&nbsp;</span> <span class="label color-block" style="background-color: #{{ object.color }}">&nbsp;</span>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -74,8 +74,8 @@
<tr> <tr>
<td>Length</td> <td>Length</td>
<td> <td>
{% if cable.length %} {% if object.length %}
{{ cable.length }} {{ cable.get_length_unit_display }} {{ object.length }} {{ object.get_length_unit_display }}
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -83,29 +83,29 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=cable %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=cable.tags.all url='dcim:cable_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:cable_list' %}
{% plugin_left_page cable %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Termination A</strong> <strong>Termination A</strong>
</div> </div>
{% include 'dcim/inc/cable_termination.html' with termination=cable.termination_a %} {% include 'dcim/inc/cable_termination.html' with termination=object.termination_a %}
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Termination B</strong> <strong>Termination B</strong>
</div> </div>
{% include 'dcim/inc/cable_termination.html' with termination=cable.termination_b %} {% include 'dcim/inc/cable_termination.html' with termination=object.termination_b %}
</div> </div>
{% plugin_right_page cable %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page cable %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -2,7 +2,7 @@
{% load helpers %} {% load helpers %}
{% block header %} {% block header %}
<h1>{% block title %}Cable Trace for {{ obj|meta:"verbose_name"|bettertitle }} {{ obj }}{% endblock %}</h1> <h1>{% block title %}Cable Trace for {{ object|meta:"verbose_name"|bettertitle }} {{ object }}{% endblock %}</h1>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -13,71 +13,71 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.get_type_display }}</td> <td>{{ object.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if instance.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:consoleport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:consoleport_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
</tr> </tr>
{% if instance.connected_endpoint %} {% if object.connected_endpoint %}
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a> <a href="{{ object.connected_endpoint.device.get_absolute_url }}">{{ object.connected_endpoint.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td> <td>
<a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a> <a href="{{ object.connected_endpoint.get_absolute_url }}">{{ object.connected_endpoint.name }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ object.connected_endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.connected_endpoint.description|placeholder }}</td> <td>{{ object.connected_endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Path Status</td> <td>Path Status</td>
<td> <td>
{% if instance.path.is_active %} {% if object.path.is_active %}
<span class="label label-success">Reachable</span> <span class="label label-success">Reachable</span>
{% else %} {% else %}
<span class="label label-danger">Not Reachable</span> <span class="label label-danger">Not Reachable</span>
@ -95,21 +95,21 @@
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:consoleport_connect' termination_a_id=instance.pk termination_b_type='console-server-port' %}?return_url={{ instance.get_absolute_url }}">Console Server Port</a></li> <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=object.pk termination_b_type='console-server-port' %}?return_url={{ object.get_absolute_url }}">Console Server Port</a></li>
<li><a href="{% url 'dcim:consoleport_connect' termination_a_id=instance.pk termination_b_type='front-port' %}?return_url={{ instance.get_absolute_url }}">Front Port</a></li> <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=object.pk termination_b_type='front-port' %}?return_url={{ object.get_absolute_url }}">Front Port</a></li>
<li><a href="{% url 'dcim:consoleport_connect' termination_a_id=instance.pk termination_b_type='rear-port' %}?return_url={{ instance.get_absolute_url }}">Rear Port</a></li> <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=object.pk termination_b_type='rear-port' %}?return_url={{ object.get_absolute_url }}">Rear Port</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -13,71 +13,71 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.get_type_display }}</td> <td>{{ object.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if instance.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:consoleserverport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:consoleserverport_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
</tr> </tr>
{% if instance.connected_endpoint %} {% if object.connected_endpoint %}
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a> <a href="{{ object.connected_endpoint.device.get_absolute_url }}">{{ object.connected_endpoint.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td> <td>
<a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a> <a href="{{ object.connected_endpoint.get_absolute_url }}">{{ object.connected_endpoint.name }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ object.connected_endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.connected_endpoint.description|placeholder }}</td> <td>{{ object.connected_endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Path Status</td> <td>Path Status</td>
<td> <td>
{% if instance.path.is_active %} {% if object.path.is_active %}
<span class="label label-success">Reachable</span> <span class="label label-success">Reachable</span>
{% else %} {% else %}
<span class="label label-danger">Not Reachable</span> <span class="label label-danger">Not Reachable</span>
@ -95,21 +95,21 @@
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=instance.pk termination_b_type='console-port' %}?return_url={{ instance.get_absolute_url }}">Console Port</a></li> <li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=object.pk termination_b_type='console-port' %}?return_url={{ object.get_absolute_url }}">Console Port</a></li>
<li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=instance.pk termination_b_type='front-port' %}?return_url={{ instance.get_absolute_url }}">Front Port</a></li> <li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=object.pk termination_b_type='front-port' %}?return_url={{ object.get_absolute_url }}">Front Port</a></li>
<li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=instance.pk termination_b_type='rear-port' %}?return_url={{ instance.get_absolute_url }}">Rear Port</a></li> <li><a href="{% url 'dcim:consoleserverport_connect' termination_a_id=object.pk termination_b_type='rear-port' %}?return_url={{ object.get_absolute_url }}">Rear Port</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -20,20 +20,20 @@
<tr> <tr>
<td>Site</td> <td>Site</td>
<td> <td>
{% if device.site.region %} {% if object.site.region %}
<a href="{{ device.site.region.get_absolute_url }}">{{ device.site.region }}</a> / <a href="{{ object.site.region.get_absolute_url }}">{{ object.site.region }}</a> /
{% endif %} {% endif %}
<a href="{% url 'dcim:site' slug=device.site.slug %}">{{ device.site }}</a> <a href="{% url 'dcim:site' slug=object.site.slug %}">{{ object.site }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Rack</td> <td>Rack</td>
<td> <td>
{% if device.rack %} {% if object.rack %}
{% if device.rack.group %} {% if object.rack.group %}
<a href="{{ device.rack.group.get_absolute_url }}">{{ device.rack.group }}</a> / <a href="{{ object.rack.group.get_absolute_url }}">{{ object.rack.group }}</a> /
{% endif %} {% endif %}
<a href="{% url 'dcim:rack' pk=device.rack.pk %}">{{ device.rack }}</a> <a href="{% url 'dcim:rack' pk=object.rack.pk %}">{{ object.rack }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -42,16 +42,16 @@
<tr> <tr>
<td>Position</td> <td>Position</td>
<td> <td>
{% if device.parent_bay %} {% if object.parent_bay %}
{% with device.parent_bay.device as parent %} {% with object.parent_bay.device as parent %}
<a href="{{ parent.get_absolute_url }}">{{ parent }}</a> / {{ device.parent_bay }} <a href="{{ parent.get_absolute_url }}">{{ parent }}</a> / {{ object.parent_bay }}
{% if parent.position %} {% if parent.position %}
(U{{ parent.position }} / {{ parent.get_face_display }}) (U{{ parent.position }} / {{ parent.get_face_display }})
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% elif device.rack and device.position %} {% elif object.rack and object.position %}
<span>U{{ device.position }} / {{ device.get_face_display }}</span> <span>U{{ object.position }} / {{ object.get_face_display }}</span>
{% elif device.rack and device.device_type.u_height %} {% elif object.rack and object.device_type.u_height %}
<span class="label label-warning">Not racked</span> <span class="label label-warning">Not racked</span>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
@ -61,11 +61,11 @@
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if device.tenant %} {% if object.tenant %}
{% if device.tenant.group %} {% if object.tenant.group %}
<a href="{{ device.tenant.group.get_absolute_url }}">{{ device.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ device.tenant.get_absolute_url }}">{{ device.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -74,16 +74,16 @@
<tr> <tr>
<td>Device Type</td> <td>Device Type</td>
<td> <td>
<span><a href="{% url 'dcim:devicetype' pk=device.device_type.pk %}">{{ device.device_type.display_name }}</a> ({{ device.device_type.u_height }}U)</span> <span><a href="{% url 'dcim:devicetype' pk=object.device_type.pk %}">{{ object.device_type.display_name }}</a> ({{ object.device_type.u_height }}U)</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Serial Number</td> <td>Serial Number</td>
<td><span>{{ device.serial|placeholder }}</span></td> <td><span>{{ object.serial|placeholder }}</span></td>
</tr> </tr>
<tr> <tr>
<td>Asset Tag</td> <td>Asset Tag</td>
<td><span>{{ device.asset_tag|placeholder }}</span></td> <td><span>{{ object.asset_tag|placeholder }}</span></td>
</tr> </tr>
</table> </table>
</div> </div>
@ -100,18 +100,18 @@
<th>Priority</th> <th>Priority</th>
</tr> </tr>
{% for vc_member in vc_members %} {% for vc_member in vc_members %}
<tr{% if vc_member == device %} class="info"{% endif %}> <tr{% if vc_member == object %} class="info"{% endif %}>
<td> <td>
<a href="{{ vc_member.get_absolute_url }}">{{ vc_member }}</a> <a href="{{ vc_member.get_absolute_url }}">{{ vc_member }}</a>
</td> </td>
<td><span class="badge badge-default">{{ vc_member.vc_position }}</span></td> <td><span class="badge badge-default">{{ vc_member.vc_position }}</span></td>
<td>{% if device.virtual_chassis.master == vc_member %}<i class="mdi mdi-check-bold"></i>{% endif %}</td> <td>{% if object.virtual_chassis.master == vc_member %}<i class="mdi mdi-check-bold"></i>{% endif %}</td>
<td>{{ vc_member.vc_priority|default:"" }}</td> <td>{{ vc_member.vc_priority|default:"" }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{{ device.virtual_chassis.get_absolute_url }}" class="btn btn-primary btn-xs"> <a href="{{ object.virtual_chassis.get_absolute_url }}" class="btn btn-primary btn-xs">
<span class="mdi mdi-arrow-right-bold" aria-hidden="true"></span> View Virtual Chassis <span class="mdi mdi-arrow-right-bold" aria-hidden="true"></span> View Virtual Chassis
</a> </a>
</div> </div>
@ -125,14 +125,14 @@
<tr> <tr>
<td>Role</td> <td>Role</td>
<td> <td>
<a href="{% url 'dcim:device_list' %}?role={{ device.device_role.slug }}">{{ device.device_role }}</a> <a href="{% url 'dcim:device_list' %}?role={{ object.device_role.slug }}">{{ object.device_role }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Platform</td> <td>Platform</td>
<td> <td>
{% if device.platform %} {% if object.platform %}
<a href="{{ device.platform.get_absolute_url }}">{{ device.platform }}</a> <a href="{{ object.platform.get_absolute_url }}">{{ object.platform }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -141,18 +141,18 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ device.get_status_class }}">{{ device.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Primary IPv4</td> <td>Primary IPv4</td>
<td> <td>
{% if device.primary_ip4 %} {% if object.primary_ip4 %}
<a href="{% url 'ipam:ipaddress' pk=device.primary_ip4.pk %}">{{ device.primary_ip4.address.ip }}</a> <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a>
{% if device.primary_ip4.nat_inside %} {% if object.primary_ip4.nat_inside %}
<span>(NAT for {{ device.primary_ip4.nat_inside.address.ip }})</span> <span>(NAT for {{ object.primary_ip4.nat_inside.address.ip }})</span>
{% elif device.primary_ip4.nat_outside %} {% elif object.primary_ip4.nat_outside %}
<span>(NAT: {{ device.primary_ip4.nat_outside.address.ip }})</span> <span>(NAT: {{ object.primary_ip4.nat_outside.address.ip }})</span>
{% endif %} {% endif %}
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
@ -162,46 +162,46 @@
<tr> <tr>
<td>Primary IPv6</td> <td>Primary IPv6</td>
<td> <td>
{% if device.primary_ip6 %} {% if object.primary_ip6 %}
<a href="{% url 'ipam:ipaddress' pk=device.primary_ip6.pk %}">{{ device.primary_ip6.address.ip }}</a> <a href="{% url 'ipam:ipaddress' pk=object.primary_ip6.pk %}">{{ object.primary_ip6.address.ip }}</a>
{% if device.primary_ip6.nat_inside %} {% if object.primary_ip6.nat_inside %}
<span>(NAT for {{ device.primary_ip6.nat_inside.address.ip }})</span> <span>(NAT for {{ object.primary_ip6.nat_inside.address.ip }})</span>
{% elif device.primary_ip6.nat_outside %} {% elif object.primary_ip6.nat_outside %}
<span>(NAT: {{ device.primary_ip6.nat_outside.address.ip }})</span> <span>(NAT: {{ object.primary_ip6.nat_outside.address.ip }})</span>
{% endif %} {% endif %}
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% if device.cluster %} {% if object.cluster %}
<tr> <tr>
<td>Cluster</td> <td>Cluster</td>
<td> <td>
{% if device.cluster.group %} {% if object.cluster.group %}
<a href="{{ device.cluster.group.get_absolute_url }}">{{ device.cluster.group }}</a> / <a href="{{ object.cluster.group.get_absolute_url }}">{{ object.cluster.group }}</a> /
{% endif %} {% endif %}
<a href="{{ device.cluster.get_absolute_url }}">{{ device.cluster }}</a> <a href="{{ object.cluster.get_absolute_url }}">{{ object.cluster }}</a>
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=device %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=device.tags.all url='dcim:device_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:device_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if device.comments %} {% if object.comments %}
{{ device.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_left_page device %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% if power_ports and poweroutlets %} {% if power_ports and poweroutlets %}
@ -255,7 +255,7 @@
{% include 'secrets/inc/assigned_secrets.html' %} {% include 'secrets/inc/assigned_secrets.html' %}
{% if perms.secrets.add_secret %} {% if perms.secrets.add_secret %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'secrets:secret_add' %}?device={{ device.pk }}&return_url={{ device.get_absolute_url }}" class="btn btn-xs btn-primary"> <a href="{% url 'secrets:secret_add' %}?device={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add secret <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add secret
</a> </a>
</div> </div>
@ -279,7 +279,7 @@
{% endif %} {% endif %}
{% if perms.ipam.add_service %} {% if perms.ipam.add_service %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'dcim:device_service_assign' device=device.pk %}" class="btn btn-xs btn-primary"> <a href="{% url 'dcim:device_service_assign' device=object.pk %}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Assign service <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Assign service
</a> </a>
</div> </div>
@ -289,10 +289,10 @@
<div class="panel-heading"> <div class="panel-heading">
<strong>Images</strong> <strong>Images</strong>
</div> </div>
{% include 'inc/image_attachments.html' with images=device.images.all %} {% include 'inc/image_attachments.html' with images=object.images.all %}
{% if perms.extras.add_imageattachment %} {% if perms.extras.add_imageattachment %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'dcim:device_add_image' object_id=device.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:device_add_image' object_id=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Attach an image Attach an image
</a> </a>
@ -325,12 +325,12 @@
<div class="panel-body text-muted">None found</div> <div class="panel-body text-muted">None found</div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page device %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page device %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
</div> </div>

View File

@ -5,19 +5,19 @@
{% load custom_links %} {% load custom_links %}
{% load plugins %} {% load plugins %}
{% block title %}{{ device }}{% endblock %} {% block title %}{{ object }}{% endblock %}
{% block header %} {% block header %}
<div class="row noprint"> <div class="row noprint">
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:device_list' %}">Devices</a></li> <li><a href="{% url 'dcim:device_list' %}">Devices</a></li>
<li><a href="{% url 'dcim:device_list' %}?site={{ device.site.slug }}">{{ device.site }}</a></li> <li><a href="{% url 'dcim:device_list' %}?site={{ object.site.slug }}">{{ object.site }}</a></li>
{% if device.parent_bay %} {% if object.parent_bay %}
<li><a href="{% url 'dcim:device' pk=device.parent_bay.device.pk %}">{{ device.parent_bay.device }}</a></li> <li><a href="{% url 'dcim:device' pk=object.parent_bay.object.pk %}">{{ object.parent_bay.device }}</a></li>
<li>{{ device.parent_bay }}</li> <li>{{ object.parent_bay }}</li>
{% endif %} {% endif %}
<li>{{ device }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -34,7 +34,7 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons device %} {% plugin_buttons object %}
{% if perms.dcim.change_device %} {% if perms.dcim.change_device %}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -42,123 +42,123 @@
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% if perms.dcim.add_consoleport %} {% if perms.dcim.add_consoleport %}
<li><a href="{% url 'dcim:consoleport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_consoleports' pk=device.pk %}">Console Ports</a></li> <li><a href="{% url 'dcim:consoleport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}">Console Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_consoleserverport %} {% if perms.dcim.add_consoleserverport %}
<li><a href="{% url 'dcim:consoleserverport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}">Console Server Ports</a></li> <li><a href="{% url 'dcim:consoleserverport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}">Console Server Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_powerport %} {% if perms.dcim.add_powerport %}
<li><a href="{% url 'dcim:powerport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_powerports' pk=device.pk %}">Power Ports</a></li> <li><a href="{% url 'dcim:powerport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}">Power Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_poweroutlet %} {% if perms.dcim.add_poweroutlet %}
<li><a href="{% url 'dcim:poweroutlet_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=device.pk %}">Power Outlets</a></li> <li><a href="{% url 'dcim:poweroutlet_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}">Power Outlets</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_interface %} {% if perms.dcim.add_interface %}
<li><a href="{% url 'dcim:interface_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_interfaces' pk=device.pk %}">Interfaces</a></li> <li><a href="{% url 'dcim:interface_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_interfaces' pk=object.pk %}">Interfaces</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_frontport %} {% if perms.dcim.add_frontport %}
<li><a href="{% url 'dcim:frontport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_frontports' pk=device.pk %}">Front Ports</a></li> <li><a href="{% url 'dcim:frontport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}">Front Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_rearport %} {% if perms.dcim.add_rearport %}
<li><a href="{% url 'dcim:rearport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_rearports' pk=device.pk %}">Rear Ports</a></li> <li><a href="{% url 'dcim:rearport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}">Rear Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_devicebay %} {% if perms.dcim.add_devicebay %}
<li><a href="{% url 'dcim:devicebay_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_devicebays' pk=device.pk %}">Device Bays</a></li> <li><a href="{% url 'dcim:devicebay_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_devicebays' pk=object.pk %}">Device Bays</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<li><a href="{% url 'dcim:inventoryitem_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_inventory' pk=device.pk %}">Inventory Items</a></li> <li><a href="{% url 'dcim:inventoryitem_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_inventory' pk=object.pk %}">Inventory Items</a></li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
{% endif %} {% endif %}
{% if perms.dcim.add_device %} {% if perms.dcim.add_device %}
{% clone_button device %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.dcim.change_device %} {% if perms.dcim.change_device %}
{% edit_button device %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_device %} {% if perms.dcim.delete_device %}
{% delete_button device %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{{ device }}</h1> <h1>{{ object }}</h1>
{% include 'inc/created_updated.html' with obj=device %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links device %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation" {% if active_tab == 'device' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'device' %} class="active"{% endif %}>
<a href="{% url 'dcim:device' pk=device.pk %}">Device</a> <a href="{% url 'dcim:device' pk=object.pk %}">Device</a>
</li> </li>
{% with interface_count=device.interfaces.count %} {% with interface_count=object.interfaces.count %}
{% if interface_count %} {% if interface_count %}
<li role="presentation" {% if active_tab == 'interfaces' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'interfaces' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_interfaces' pk=device.pk %}">Interfaces {% badge interface_count %}</a> <a href="{% url 'dcim:device_interfaces' pk=object.pk %}">Interfaces {% badge interface_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with frontport_count=device.frontports.count %} {% with frontport_count=object.frontports.count %}
{% if frontport_count %} {% if frontport_count %}
<li role="presentation" {% if active_tab == 'front-ports' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'front-ports' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_frontports' pk=device.pk %}">Front Ports {% badge frontport_count %}</a> <a href="{% url 'dcim:device_frontports' pk=object.pk %}">Front Ports {% badge frontport_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with rearport_count=device.rearports.count %} {% with rearport_count=object.rearports.count %}
{% if rearport_count %} {% if rearport_count %}
<li role="presentation" {% if active_tab == 'rear-ports' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'rear-ports' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_rearports' pk=device.pk %}">Rear Ports {% badge rearport_count %}</a> <a href="{% url 'dcim:device_rearports' pk=object.pk %}">Rear Ports {% badge rearport_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with consoleport_count=device.consoleports.count %} {% with consoleport_count=object.consoleports.count %}
{% if consoleport_count %} {% if consoleport_count %}
<li role="presentation" {% if active_tab == 'console-ports' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'console-ports' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_consoleports' pk=device.pk %}">Console Ports {% badge consoleport_count %}</a> <a href="{% url 'dcim:device_consoleports' pk=object.pk %}">Console Ports {% badge consoleport_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with consoleserverport_count=device.consoleserverports.count %} {% with consoleserverport_count=object.consoleserverports.count %}
{% if consoleserverport_count %} {% if consoleserverport_count %}
<li role="presentation" {% if active_tab == 'console-server-ports' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'console-server-ports' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_consoleserverports' pk=device.pk %}">Console Server Ports {% badge consoleserverport_count %}</a> <a href="{% url 'dcim:device_consoleserverports' pk=object.pk %}">Console Server Ports {% badge consoleserverport_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with powerport_count=device.powerports.count %} {% with powerport_count=object.powerports.count %}
{% if powerport_count %} {% if powerport_count %}
<li role="presentation" {% if active_tab == 'power-ports' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'power-ports' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_powerports' pk=device.pk %}">Power Ports {% badge powerport_count %}</a> <a href="{% url 'dcim:device_powerports' pk=object.pk %}">Power Ports {% badge powerport_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with poweroutlet_count=device.poweroutlets.count %} {% with poweroutlet_count=object.poweroutlets.count %}
{% if poweroutlet_count %} {% if poweroutlet_count %}
<li role="presentation" {% if active_tab == 'power-outlets' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'power-outlets' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_poweroutlets' pk=device.pk %}">Power Outlets {% badge poweroutlet_count %}</a> <a href="{% url 'dcim:device_poweroutlets' pk=object.pk %}">Power Outlets {% badge poweroutlet_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with devicebay_count=device.devicebays.count %} {% with devicebay_count=object.devicebays.count %}
{% if devicebay_count %} {% if devicebay_count %}
<li role="presentation" {% if active_tab == 'device-bays' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'device-bays' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_devicebays' pk=device.pk %}">Device Bays {% badge devicebay_count %}</a> <a href="{% url 'dcim:device_devicebays' pk=object.pk %}">Device Bays {% badge devicebay_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% with inventoryitem_count=device.inventoryitems.count %} {% with inventoryitem_count=object.inventoryitems.count %}
{% if inventoryitem_count %} {% if inventoryitem_count %}
<li role="presentation" {% if active_tab == 'inventory' %} class="active"{% endif %}> <li role="presentation" {% if active_tab == 'inventory' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_inventory' pk=device.pk %}">Inventory {% badge inventoryitem_count %}</a> <a href="{% url 'dcim:device_inventory' pk=object.pk %}">Inventory {% badge inventoryitem_count %}</a>
</li> </li>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% if perms.dcim.napalm_read_device %} {% if perms.dcim.napalm_read_device %}
{% if device.status != 'active' %} {% if object.status != 'active' %}
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %} {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %}
{% elif not device.platform %} {% elif not object.platform %}
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %} {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %}
{% elif not device.platform.napalm_driver %} {% elif not object.platform.napalm_driver %}
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No NAPALM driver assigned for this platform' %} {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No NAPALM driver assigned for this platform' %}
{% else %} {% else %}
{% include 'dcim/inc/device_napalm_tabs.html' %} {% include 'dcim/inc/device_napalm_tabs.html' %}
@ -166,12 +166,12 @@
{% endif %} {% endif %}
{% if perms.extras.view_configcontext %} {% if perms.extras.view_configcontext %}
<li role="presentation"{% if active_tab == 'config-context' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'config-context' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_configcontext' pk=device.pk %}">Config Context</a> <a href="{% url 'dcim:device_configcontext' pk=object.pk %}">Config Context</a>
</li> </li>
{% endif %} {% endif %}
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_changelog' pk=device.pk %}">Change Log</a> <a href="{% url 'dcim:device_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>

View File

@ -1,7 +1,7 @@
{% extends 'dcim/device/base.html' %} {% extends 'dcim/device/base.html' %}
{% load static %} {% load static %}
{% block title %}{{ device }} - Config{% endblock %} {% block title %}{{ object }} - Config{% endblock %}
{% block content %} {% block content %}
{% include 'inc/ajax_loader.html' %} {% include 'inc/ajax_loader.html' %}
@ -36,7 +36,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$.ajax({ $.ajax({
url: "{% url 'dcim-api:device-napalm' pk=device.pk %}?method=get_config", url: "{% url 'dcim-api:device-napalm' pk=object.pk %}?method=get_config",
dataType: 'json', dataType: 'json',
success: function(json) { success: function(json) {
$('#running_config').html($.trim(json['get_config']['running'])); $('#running_config').html($.trim(json['get_config']['running']));

View File

@ -18,24 +18,24 @@
{% render_table consoleport_table 'inc/table.html' %} {% render_table consoleport_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_consoleport %} {% if perms.dcim.change_consoleport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:consoleport_bulk_rename' %}?return_url={% url 'dcim:device_consoleports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:consoleport_bulk_rename' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:consoleport_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_consoleports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:consoleport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
<button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleport_bulk_disconnect' %}?return_url={% url 'dcim:device_consoleports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleport_bulk_disconnect' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_consoleport %} {% if perms.dcim.delete_consoleport %}
<button type="submit" name="_delete" formaction="{% url 'dcim:consoleport_bulk_delete' %}?return_url={% url 'dcim:device_consoleports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_delete" formaction="{% url 'dcim:consoleport_bulk_delete' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_consoleport %} {% if perms.dcim.add_consoleport %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:consoleport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_consoleports' pk=device.pk %}" class="btn btn-xs btn-primary"> <a href="{% url 'dcim:consoleport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add console port <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add console port
</a> </a>
</div> </div>

View File

@ -18,24 +18,24 @@
{% render_table consoleserverport_table 'inc/table.html' %} {% render_table consoleserverport_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_consoleserverport %} {% if perms.dcim.change_consoleserverport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:consoleserverport_bulk_rename' %}?return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:consoleserverport_bulk_rename' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:consoleserverport_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:consoleserverport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
<button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleserverport_bulk_disconnect' %}?return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleserverport_bulk_disconnect' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_consoleserverport %} {% if perms.dcim.delete_consoleserverport %}
<button type="submit" formaction="{% url 'dcim:consoleserverport_bulk_delete' %}?return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" formaction="{% url 'dcim:consoleserverport_bulk_delete' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_consoleserverport %} {% if perms.dcim.add_consoleserverport %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:consoleserverport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=device.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:consoleserverport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add console server ports <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add console server ports
</a> </a>
</div> </div>

View File

@ -18,21 +18,21 @@
{% render_table devicebay_table 'inc/table.html' %} {% render_table devicebay_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_devicebay %} {% if perms.dcim.change_devicebay %}
<button type="submit" name="_rename" formaction="{% url 'dcim:devicebay_bulk_rename' %}?return_url={{ device.get_absolute_url }}%23tab_devicebays" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:devicebay_bulk_rename' %}?return_url={{ object.get_absolute_url }}%23tab_devicebays" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:devicebay_bulk_edit' %}?device={{ device.pk }}&return_url={{ device.get_absolute_url }}%23tab_devicebays" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:devicebay_bulk_edit' %}?device={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_devicebays" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_devicebay %} {% if perms.dcim.delete_devicebay %}
<button type="submit" formaction="{% url 'dcim:devicebay_bulk_delete' %}?return_url={{ device.get_absolute_url }}%23tab_devicebays" class="btn btn-danger btn-xs"> <button type="submit" formaction="{% url 'dcim:devicebay_bulk_delete' %}?return_url={{ object.get_absolute_url }}%23tab_devicebays" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete selected <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete selected
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_devicebay %} {% if perms.dcim.add_devicebay %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:devicebay_add' %}?device={{ device.pk }}&return_url={{ device.get_absolute_url }}%23tab_devicebays" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:devicebay_add' %}?device={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_devicebays" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add device bays <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add device bays
</a> </a>
</div> </div>

View File

@ -18,24 +18,24 @@
{% render_table frontport_table 'inc/table.html' %} {% render_table frontport_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_frontport %} {% if perms.dcim.change_frontport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:frontport_bulk_rename' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:frontport_bulk_rename' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:frontport_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_frontports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:frontport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
<button type="submit" name="_disconnect" formaction="{% url 'dcim:frontport_bulk_disconnect' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_disconnect" formaction="{% url 'dcim:frontport_bulk_disconnect' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_frontport %} {% if perms.dcim.delete_frontport %}
<button type="submit" formaction="{% url 'dcim:frontport_bulk_delete' %}?return_url={% url 'dcim:device_frontports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" formaction="{% url 'dcim:frontport_bulk_delete' %}?return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_frontport %} {% if perms.dcim.add_frontport %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:frontport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_frontports' pk=device.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:frontport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add front ports <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add front ports
</a> </a>
</div> </div>

View File

@ -21,24 +21,24 @@
{% render_table interface_table 'inc/table.html' %} {% render_table interface_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_interface %} {% if perms.dcim.change_interface %}
<button type="submit" name="_rename" formaction="{% url 'dcim:interface_bulk_rename' %}?return_url={% url 'dcim:device_interfaces' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:interface_bulk_rename' %}?return_url={% url 'dcim:device_interfaces' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:interface_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_interfaces' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:interface_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_interfaces' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
<button type="submit" name="_disconnect" formaction="{% url 'dcim:interface_bulk_disconnect' %}?return_url={% url 'dcim:device_interfaces' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_disconnect" formaction="{% url 'dcim:interface_bulk_disconnect' %}?return_url={% url 'dcim:device_interfaces' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_interface %} {% if perms.dcim.delete_interface %}
<button type="submit" name="_delete" formaction="{% url 'dcim:interface_bulk_delete' %}?return_url={% url 'dcim:device_interfaces' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_delete" formaction="{% url 'dcim:interface_bulk_delete' %}?return_url={% url 'dcim:device_interfaces' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_interface %} {% if perms.dcim.add_interface %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:interface_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_interfaces' pk=device.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:interface_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_interfaces' pk=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add interfaces <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add interfaces
</a> </a>
</div> </div>

View File

@ -18,21 +18,21 @@
{% render_table inventoryitem_table 'inc/table.html' %} {% render_table inventoryitem_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_inventoryitem %} {% if perms.dcim.change_inventoryitem %}
<button type="submit" name="_rename" formaction="{% url 'dcim:inventoryitem_bulk_rename' %}?return_url={% url 'dcim:device_inventory' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:inventoryitem_bulk_rename' %}?return_url={% url 'dcim:device_inventory' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:inventoryitem_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_inventory' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:inventoryitem_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_inventory' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_inventoryitem %} {% if perms.dcim.delete_inventoryitem %}
<button type="submit" name="_delete" formaction="{% url 'dcim:inventoryitem_bulk_delete' %}?return_url={% url 'dcim:device_inventory' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_delete" formaction="{% url 'dcim:inventoryitem_bulk_delete' %}?return_url={% url 'dcim:device_inventory' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_inventory' pk=device.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:inventoryitem_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_inventory' pk=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Inventory Item <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Inventory Item
</a> </a>
</div> </div>

View File

@ -1,6 +1,6 @@
{% extends 'dcim/device/base.html' %} {% extends 'dcim/device/base.html' %}
{% block title %}{{ device }} - LLDP Neighbors{% endblock %} {% block title %}{{ object }} - LLDP Neighbors{% endblock %}
{% block content %} {% block content %}
{% include 'inc/ajax_loader.html' %} {% include 'inc/ajax_loader.html' %}
@ -52,7 +52,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$.ajax({ $.ajax({
url: "{% url 'dcim-api:device-napalm' pk=device.pk %}?method=get_lldp_neighbors_detail", url: "{% url 'dcim-api:device-napalm' pk=object.pk %}?method=get_lldp_neighbors_detail",
dataType: 'json', dataType: 'json',
success: function(json) { success: function(json) {
$.each(json['get_lldp_neighbors_detail'], function(iface, neighbors) { $.each(json['get_lldp_neighbors_detail'], function(iface, neighbors) {

View File

@ -18,24 +18,24 @@
{% render_table poweroutlet_table 'inc/table.html' %} {% render_table poweroutlet_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_powerport %} {% if perms.dcim.change_powerport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:poweroutlet_bulk_rename' %}?return_url={% url 'dcim:device_poweroutlets' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:poweroutlet_bulk_rename' %}?return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:poweroutlet_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:poweroutlet_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
<button type="submit" name="_disconnect" formaction="{% url 'dcim:poweroutlet_bulk_disconnect' %}?return_url={% url 'dcim:device_poweroutlets' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_disconnect" formaction="{% url 'dcim:poweroutlet_bulk_disconnect' %}?return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_poweroutlet %} {% if perms.dcim.delete_poweroutlet %}
<button type="submit" formaction="{% url 'dcim:poweroutlet_bulk_delete' %}?return_url={% url 'dcim:device_poweroutlets' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" formaction="{% url 'dcim:poweroutlet_bulk_delete' %}?return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_poweroutlet %} {% if perms.dcim.add_poweroutlet %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:poweroutlet_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=device.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:poweroutlet_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add power outlets <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add power outlets
</a> </a>
</div> </div>

View File

@ -18,24 +18,24 @@
{% render_table powerport_table 'inc/table.html' %} {% render_table powerport_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_powerport %} {% if perms.dcim.change_powerport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:powerport_bulk_rename' %}?return_url={% url 'dcim:device_powerports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:powerport_bulk_rename' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:powerport_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_powerports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:powerport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
<button type="submit" name="_disconnect" formaction="{% url 'dcim:powerport_bulk_disconnect' %}?return_url={% url 'dcim:device_powerports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_disconnect" formaction="{% url 'dcim:powerport_bulk_disconnect' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_powerport %} {% if perms.dcim.delete_powerport %}
<button type="submit" name="_delete" formaction="{% url 'dcim:powerport_bulk_delete' %}?return_url={% url 'dcim:device_powerports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_delete" formaction="{% url 'dcim:powerport_bulk_delete' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_powerport %} {% if perms.dcim.add_powerport %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:powerport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_powerports' pk=device.pk %}" class="btn btn-xs btn-primary"> <a href="{% url 'dcim:powerport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add power port <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add power port
</a> </a>
</div> </div>

View File

@ -18,24 +18,24 @@
{% render_table rearport_table 'inc/table.html' %} {% render_table rearport_table 'inc/table.html' %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if perms.dcim.change_rearport %} {% if perms.dcim.change_rearport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:rearport_bulk_rename' %}?return_url={% url 'dcim:device_rearports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'dcim:rearport_bulk_rename' %}?return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'dcim:rearport_bulk_edit' %}?device={{ device.pk }}&return_url={% url 'dcim:device_rearports' pk=device.pk %}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'dcim:rearport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
<button type="submit" name="_disconnect" formaction="{% url 'dcim:rearport_bulk_disconnect' %}?return_url={% url 'dcim:device_rearports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" name="_disconnect" formaction="{% url 'dcim:rearport_bulk_disconnect' %}?return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.delete_rearport %} {% if perms.dcim.delete_rearport %}
<button type="submit" formaction="{% url 'dcim:rearport_bulk_delete' %}?return_url={% url 'dcim:device_rearports' pk=device.pk %}" class="btn btn-danger btn-xs"> <button type="submit" formaction="{% url 'dcim:rearport_bulk_delete' %}?return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.dcim.add_rearport %} {% if perms.dcim.add_rearport %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'dcim:rearport_add' %}?device={{ device.pk }}&return_url={% url 'dcim:device_rearports' pk=device.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:rearport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add rear ports <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add rear ports
</a> </a>
</div> </div>

View File

@ -70,7 +70,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$.ajax({ $.ajax({
url: "{% url 'dcim-api:device-napalm' pk=device.pk %}?method=get_facts&method=get_environment", url: "{% url 'dcim-api:device-napalm' pk=object.pk %}?method=get_facts&method=get_environment",
dataType: 'json', dataType: 'json',
success: function(json) { success: function(json) {
if (!json['get_facts']['error']) { if (!json['get_facts']['error']) {

View File

@ -8,33 +8,33 @@
<div class="col-md-12"> <div class="col-md-12">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:device_list' %}">Devices</a></li> <li><a href="{% url 'dcim:device_list' %}">Devices</a></li>
<li><a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a></li> <li><a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a></li>
<li><a href="{% url instance|viewname:"list" %}?device_id={{ instance.device.pk }}">{{ instance|meta:"verbose_name_plural"|bettertitle }}</a></li> <li><a href="{% url object|viewname:"list" %}?device_id={{ object.device.pk }}">{{ object|meta:"verbose_name_plural"|bettertitle }}</a></li>
<li>{{ instance }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons instance %} {% plugin_buttons object %}
{% if request.user|can_change:instance %} {% if request.user|can_change:object %}
<a href="{% url instance|viewname:"edit" pk=instance.pk %}" class="btn btn-warning"> <a href="{% url object|viewname:"edit" pk=object.pk %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</a> </a>
{% endif %} {% endif %}
{% if request.user|can_delete:instance %} {% if request.user|can_delete:object %}
<a href="{% url instance|viewname:"delete" pk=instance.pk %}" class="btn btn-danger"> <a href="{% url object|viewname:"delete" pk=object.pk %}" class="btn btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</a> </a>
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ instance.device }} / {{ instance }}{% endblock %}</h1> <h1>{% block title %}{{ object.device }} / {{ object }}{% endblock %}</h1>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ instance.get_absolute_url }}">{{ instance|meta:"verbose_name"|bettertitle }}</a> <a href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url instance|viewname:"changelog" pk=instance.pk %}">Change Log</a> <a href="{% url object|viewname:"changelog" pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>

View File

@ -13,33 +13,33 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Installed Device</strong> <strong>Installed Device</strong>
</div> </div>
{% if instance.installed_device %} {% if object.installed_device %}
{% with device=instance.installed_device %} {% with device=object.installed_device %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Device</td> <td>Device</td>
@ -59,12 +59,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -4,20 +4,20 @@
{% load helpers %} {% load helpers %}
{% load plugins %} {% load plugins %}
{% block title %}{{ devicetype.manufacturer }} {{ devicetype.model }}{% endblock %} {% block title %}{{ object.manufacturer }} {{ object.model }}{% endblock %}
{% block header %} {% block header %}
<div class="row noprint"> <div class="row noprint">
<div class="col-md-12"> <div class="col-md-12">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:devicetype_list' %}">Device Types</a></li> <li><a href="{% url 'dcim:devicetype_list' %}">Device Types</a></li>
<li><a href="{% url 'dcim:devicetype_list' %}?manufacturer={{ devicetype.manufacturer.slug }}">{{ devicetype.manufacturer }}</a></li> <li><a href="{% url 'dcim:devicetype_list' %}?manufacturer={{ object.manufacturer.slug }}">{{ object.manufacturer }}</a></li>
<li>{{ devicetype.model }}</li> <li>{{ object.model }}</li>
</ol> </ol>
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons devicetype %} {% plugin_buttons object %}
{% if perms.dcim.change_devicetype %} {% if perms.dcim.change_devicetype %}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -25,54 +25,54 @@
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% if perms.dcim.add_consoleporttemplate %} {% if perms.dcim.add_consoleporttemplate %}
<li><a href="{% url 'dcim:consoleporttemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_consoleports">Console Ports</a></li> <li><a href="{% url 'dcim:consoleporttemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_consoleports">Console Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_consoleserverporttemplate %} {% if perms.dcim.add_consoleserverporttemplate %}
<li><a href="{% url 'dcim:consoleserverporttemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_consoleserverports">Console Server Ports</a></li> <li><a href="{% url 'dcim:consoleserverporttemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_consoleserverports">Console Server Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_powerporttemplate %} {% if perms.dcim.add_powerporttemplate %}
<li><a href="{% url 'dcim:powerporttemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_powerports">Power Ports</a></li> <li><a href="{% url 'dcim:powerporttemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_powerports">Power Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_poweroutlettemplate %} {% if perms.dcim.add_poweroutlettemplate %}
<li><a href="{% url 'dcim:poweroutlettemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_poweroutlets">Power Outlets</a></li> <li><a href="{% url 'dcim:poweroutlettemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_poweroutlets">Power Outlets</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_interfacetemplate %} {% if perms.dcim.add_interfacetemplate %}
<li><a href="{% url 'dcim:interfacetemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_interfaces">Interfaces</a></li> <li><a href="{% url 'dcim:interfacetemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_interfaces">Interfaces</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_frontporttemplate %} {% if perms.dcim.add_frontporttemplate %}
<li><a href="{% url 'dcim:frontporttemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_frontports">Front Ports</a></li> <li><a href="{% url 'dcim:frontporttemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_frontports">Front Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_rearporttemplate %} {% if perms.dcim.add_rearporttemplate %}
<li><a href="{% url 'dcim:rearporttemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_rearports">Rear Ports</a></li> <li><a href="{% url 'dcim:rearporttemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_rearports">Rear Ports</a></li>
{% endif %} {% endif %}
{% if perms.dcim.add_devicebaytemplate %} {% if perms.dcim.add_devicebaytemplate %}
<li><a href="{% url 'dcim:devicebaytemplate_add' %}?device_type={{ devicetype.pk }}&return_url={{ devicetype.get_absolute_url }}%23tab_devicebays">Device Bays</a></li> <li><a href="{% url 'dcim:devicebaytemplate_add' %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_devicebays">Device Bays</a></li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
{% endif %} {% endif %}
{% if perms.dcim.add_devicetype %} {% if perms.dcim.add_devicetype %}
{% clone_button devicetype %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.dcim.change_devicetype %} {% if perms.dcim.change_devicetype %}
{% edit_button devicetype use_pk=True %} {% edit_button object use_pk=True %}
{% endif %} {% endif %}
{% if perms.dcim.delete_devicetype %} {% if perms.dcim.delete_devicetype %}
{% delete_button devicetype use_pk=True %} {% delete_button object use_pk=True %}
{% endif %} {% endif %}
</div> </div>
<h1>{{ devicetype.manufacturer }} {{ devicetype.model }}</h1> <h1>{{ object.manufacturer }} {{ object.model }}</h1>
{% include 'inc/created_updated.html' with obj=devicetype %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links devicetype %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ devicetype.get_absolute_url }}">Device Type</a> <a href="{{ object.get_absolute_url }}">Device Type</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:devicetype_changelog' pk=devicetype.pk %}">Change Log</a> <a href="{% url 'dcim:devicetype_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -88,27 +88,27 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Manufacturer</td> <td>Manufacturer</td>
<td><a href="{% url 'dcim:devicetype_list' %}?manufacturer={{ devicetype.manufacturer.slug }}">{{ devicetype.manufacturer }}</a></td> <td><a href="{% url 'dcim:devicetype_list' %}?manufacturer={{ object.manufacturer.slug }}">{{ object.manufacturer }}</a></td>
</tr> </tr>
<tr> <tr>
<td>Model Name</td> <td>Model Name</td>
<td> <td>
{{ devicetype.model }}<br/> {{ object.model }}<br/>
<small class="text-muted">{{ devicetype.slug }}</small> <small class="text-muted">{{ object.slug }}</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Part Number</td> <td>Part Number</td>
<td>{{ devicetype.part_number|placeholder }}</td> <td>{{ object.part_number|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Height (U)</td> <td>Height (U)</td>
<td>{{ devicetype.u_height }}</td> <td>{{ object.u_height }}</td>
</tr> </tr>
<tr> <tr>
<td>Full Depth</td> <td>Full Depth</td>
<td> <td>
{% if devicetype.is_full_depth %} {% if object.is_full_depth %}
<i class="mdi mdi-check-bold text-success" title="Yes"></i> <i class="mdi mdi-check-bold text-success" title="Yes"></i>
{% else %} {% else %}
<i class="mdi mdi-close-thick text-danger" title="No"></i> <i class="mdi mdi-close-thick text-danger" title="No"></i>
@ -118,15 +118,15 @@
<tr> <tr>
<td>Parent/Child</td> <td>Parent/Child</td>
<td> <td>
{{ devicetype.get_subdevice_role_display|placeholder }} {{ object.get_subdevice_role_display|placeholder }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Front Image</td> <td>Front Image</td>
<td> <td>
{% if devicetype.front_image %} {% if object.front_image %}
<a href="{{ devicetype.front_image.url }}"> <a href="{{ object.front_image.url }}">
<img src="{{ devicetype.front_image.url }}" alt="{{ devicetype.front_image.name }}" class="img-responsive" /> <img src="{{ object.front_image.url }}" alt="{{ object.front_image.name }}" class="img-responsive" />
</a> </a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
@ -136,9 +136,9 @@
<tr> <tr>
<td>Rear Image</td> <td>Rear Image</td>
<td> <td>
{% if devicetype.rear_image %} {% if object.rear_image %}
<a href="{{ devicetype.rear_image.url }}"> <a href="{{ object.rear_image.url }}">
<img src="{{ devicetype.rear_image.url }}" alt="{{ devicetype.rear_image.name }}" class="img-responsive" /> <img src="{{ object.rear_image.url }}" alt="{{ object.rear_image.name }}" class="img-responsive" />
</a> </a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
@ -147,33 +147,33 @@
</tr> </tr>
<tr> <tr>
<td>Instances</td> <td>Instances</td>
<td><a href="{% url 'dcim:device_list' %}?device_type_id={{ devicetype.pk }}">{{ instance_count }}</a></td> <td><a href="{% url 'dcim:device_list' %}?device_type_id={{ object.pk }}">{{ instance_count }}</a></td>
</tr> </tr>
</table> </table>
</div> </div>
{% plugin_left_page devicetype %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'inc/custom_fields_panel.html' with obj=devicetype %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=devicetype.tags.all url='dcim:devicetype_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:devicetype_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if devicetype.comments %} {% if object.comments %}
{{ devicetype.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_right_page devicetype %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page devicetype %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -13,52 +13,52 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.get_type_display }}</td> <td>{{ object.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Rear Port</td> <td>Rear Port</td>
<td> <td>
<a href="{{ instance.rear_port.get_absolute_url }}">{{ instance.rear_port }}</a> <a href="{{ object.rear_port.get_absolute_url }}">{{ object.rear_port }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Rear Port Position</td> <td>Rear Port Position</td>
<td>{{ instance.rear_port_position }}</td> <td>{{ object.rear_port_position }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if instance.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:frontport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:frontport_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
@ -66,10 +66,10 @@
<tr> <tr>
<td>Connection Status</td> <td>Connection Status</td>
<td> <td>
{% if instance.cable.status %} {% if object.cable.status %}
<span class="label label-success">{{ instance.cable.get_status_display }}</span> <span class="label label-success">{{ object.cable.get_status_display }}</span>
{% else %} {% else %}
<span class="label label-info">{{ instance.cable.get_status_display }}</span> <span class="label label-info">{{ object.cable.get_status_display }}</span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
@ -83,24 +83,24 @@
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=instance.pk termination_b_type='interface' %}?return_url={{ instance.get_absolute_url }}">Interface</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=object.pk termination_b_type='interface' %}?return_url={{ object.get_absolute_url }}">Interface</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=instance.pk termination_b_type='console-server-port' %}?return_url={{ instance.get_absolute_url }}">Console Server Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=object.pk termination_b_type='console-server-port' %}?return_url={{ object.get_absolute_url }}">Console Server Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=instance.pk termination_b_type='console-port' %}?return_url={{ instance.get_absolute_url }}">Console Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=object.pk termination_b_type='console-port' %}?return_url={{ object.get_absolute_url }}">Console Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=instance.pk termination_b_type='front-port' %}?return_url={{ instance.get_absolute_url }}">Front Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=object.pk termination_b_type='front-port' %}?return_url={{ object.get_absolute_url }}">Front Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=instance.pk termination_b_type='rear-port' %}?return_url={{ instance.get_absolute_url }}">Rear Port</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=object.pk termination_b_type='rear-port' %}?return_url={{ object.get_absolute_url }}">Rear Port</a></li>
<li><a href="{% url 'dcim:frontport_connect' termination_a_id=instance.pk termination_b_type='circuit-termination' %}?return_url={{ instance.get_absolute_url }}">Circuit Termination</a></li> <li><a href="{% url 'dcim:frontport_connect' termination_a_id=object.pk termination_b_type='circuit-termination' %}?return_url={{ object.get_absolute_url }}">Circuit Termination</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,12 +1,12 @@
{% if not disabled_message %} {% if not disabled_message %}
<li role="presentation"{% if active_tab == 'status' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'status' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_status' pk=device.pk %}">Status</a> <a href="{% url 'dcim:device_status' pk=object.pk %}">Status</a>
</li> </li>
<li role="presentation"{% if active_tab == 'lldp-neighbors' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'lldp-neighbors' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_lldp_neighbors' pk=device.pk %}">LLDP Neighbors</a> <a href="{% url 'dcim:device_lldp_neighbors' pk=object.pk %}">LLDP Neighbors</a>
</li> </li>
<li role="presentation"{% if active_tab == 'config' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'config' %} class="active"{% endif %}>
<a href="{% url 'dcim:device_config' pk=device.pk %}">Configuration</a> <a href="{% url 'dcim:device_config' pk=object.pk %}">Configuration</a>
</li> </li>
{% else %} {% else %}
<li role="presentation" class="disabled"><a href="#" title="{{ disabled_message }}">Status</a></li> <li role="presentation" class="disabled"><a href="#" title="{{ disabled_message }}">Status</a></li>

View File

@ -1,8 +1,8 @@
<div style="margin-left: -30px"> <div style="margin-left: -30px">
<object data="{% url 'dcim-api:rack-elevation' pk=rack.pk %}?face={{face}}&render=svg" class="rack_elevation"></object> <object data="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{face}}&render=svg" class="rack_elevation"></object>
</div> </div>
<div class="text-center text-small"> <div class="text-center text-small">
<a href="{% url 'dcim-api:rack-elevation' pk=rack.pk %}?face={{face}}&render=svg"> <a href="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{face}}&render=svg">
<i class="mdi mdi-content-save-outline"></i> Save SVG <i class="mdi mdi-content-save-outline"></i> Save SVG
</a> </a>
</div> </div>

View File

@ -13,25 +13,25 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.get_type_display }}</td> <td>{{ object.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Enabled</td> <td>Enabled</td>
<td> <td>
{% if instance.enabled %} {% if object.enabled %}
<span class="text-success"><i class="mdi mdi-check-bold"></i></span> <span class="text-success"><i class="mdi mdi-check-bold"></i></span>
{% else %} {% else %}
<span class="text-danger"><i class="mdi mdi-close"></i></span> <span class="text-danger"><i class="mdi mdi-close"></i></span>
@ -41,8 +41,8 @@
<tr> <tr>
<td>LAG</td> <td>LAG</td>
<td> <td>
{% if instance.lag%} {% if object.lag%}
<a href="{{ instance.lag.get_absolute_url }}">{{ instance.lag }}</a> <a href="{{ object.lag.get_absolute_url }}">{{ object.lag }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -50,44 +50,44 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }} </td> <td>{{ object.description|placeholder }} </td>
</tr> </tr>
<tr> <tr>
<td>MTU</td> <td>MTU</td>
<td>{{ instance.mtu|placeholder }}</td> <td>{{ object.mtu|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>MAC Address</td> <td>MAC Address</td>
<td><span class="text-monospace">{{ instance.mac_address|placeholder }}</span></td> <td><span class="text-monospace">{{ object.mac_address|placeholder }}</span></td>
</tr> </tr>
<tr> <tr>
<td>802.1Q Mode</td> <td>802.1Q Mode</td>
<td>{{ instance.get_mode_display }}</td> <td>{{ object.get_mode_display }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% if instance.is_connectable %} {% if object.is_connectable %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if instance.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:interface_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:interface_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
</tr> </tr>
{% if instance.connected_endpoint.device %} {% if object.connected_endpoint.device %}
{% with iface=instance.connected_endpoint %} {% with iface=object.connected_endpoint %}
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
@ -141,8 +141,8 @@
<td>{{ iface.get_mode_display }}</td> <td>{{ iface.get_mode_display }}</td>
</tr> </tr>
{% endwith %} {% endwith %}
{% elif instance.connected_endpoint.circuit %} {% elif object.connected_endpoint.circuit %}
{% with ct=instance.connected_endpoint %} {% with ct=object.connected_endpoint %}
<tr> <tr>
<td>Provider</td> <td>Provider</td>
<td><a href="{{ ct.circuit.provider.get_absolute_url }}">{{ ct.circuit.provider }}</a></td> <td><a href="{{ ct.circuit.provider.get_absolute_url }}">{{ ct.circuit.provider }}</a></td>
@ -160,7 +160,7 @@
<tr> <tr>
<td>Path Status</td> <td>Path Status</td>
<td> <td>
{% if instance.path.is_active %} {% if object.path.is_active %}
<span class="label label-success">Reachable</span> <span class="label label-success">Reachable</span>
{% else %} {% else %}
<span class="label label-danger">Not Reachable</span> <span class="label label-danger">Not Reachable</span>
@ -177,10 +177,10 @@
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:interface_connect' termination_a_id=instance.pk termination_b_type='interface' %}?return_url={{ instance.get_absolute_url }}">Interface</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='interface' %}?return_url={{ object.get_absolute_url }}">Interface</a></li>
<li><a href="{% url 'dcim:interface_connect' termination_a_id=instance.pk termination_b_type='front-port' %}?return_url={{ instance.get_absolute_url }}">Front Port</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='front-port' %}?return_url={{ object.get_absolute_url }}">Front Port</a></li>
<li><a href="{% url 'dcim:interface_connect' termination_a_id=instance.pk termination_b_type='rear-port' %}?return_url={{ instance.get_absolute_url }}">Rear Port</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='rear-port' %}?return_url={{ object.get_absolute_url }}">Rear Port</a></li>
<li><a href="{% url 'dcim:interface_connect' termination_a_id=instance.pk termination_b_type='circuit-termination' %}?return_url={{ instance.get_absolute_url }}">Circuit Termination</a></li> <li><a href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='circuit-termination' %}?return_url={{ object.get_absolute_url }}">Circuit Termination</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
@ -188,7 +188,7 @@
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% if instance.is_lag %} {% if object.is_lag %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"><strong>LAG Members</strong></div> <div class="panel-heading"><strong>LAG Members</strong></div>
<table class="table table-hover table-headings panel-body"> <table class="table table-hover table-headings panel-body">
@ -200,7 +200,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for member in instance.member_interfaces.all %} {% for member in object.member_interfaces.all %}
<tr> <tr>
<td> <td>
<a href="{{ member.device.get_absolute_url }}">{{ member.device }}</a> <a href="{{ member.device.get_absolute_url }}">{{ member.device }}</a>
@ -221,7 +221,7 @@
</table> </table>
</div> </div>
{% endif %} {% endif %}
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -236,7 +236,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -13,14 +13,14 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Parent Item</td> <td>Parent Item</td>
<td> <td>
{% if instance.parent %} {% if object.parent %}
<a href="{{ instance.parent.get_absolute_url }}">{{ instance.parent }}</a> <a href="{{ object.parent.get_absolute_url }}">{{ object.parent }}</a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -28,17 +28,17 @@
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Manufacturer</td> <td>Manufacturer</td>
<td> <td>
{% if instance.manufacturer %} {% if object.manufacturer %}
<a href="{{ instance.manufacturer.get_absolute_url }}">{{ instance.manufacturer }}</a> <a href="{{ object.manufacturer.get_absolute_url }}">{{ object.manufacturer }}</a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -46,32 +46,32 @@
</tr> </tr>
<tr> <tr>
<td>Part ID</td> <td>Part ID</td>
<td>{{ instance.part_id|placeholder }}</td> <td>{{ object.part_id|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Serial</td> <td>Serial</td>
<td>{{ instance.serial|placeholder }}</td> <td>{{ object.serial|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Asset Tag</td> <td>Asset Tag</td>
<td>{{ instance.asset_tag|placeholder }}</td> <td>{{ object.asset_tag|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -10,12 +10,12 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:powerfeed_list' %}">Power Feeds</a></li> <li><a href="{% url 'dcim:powerfeed_list' %}">Power Feeds</a></li>
<li><a href="{{ powerfeed.power_panel.site.get_absolute_url }}">{{ powerfeed.power_panel.site }}</a></li> <li><a href="{{ object.power_panel.site.get_absolute_url }}">{{ object.power_panel.site }}</a></li>
<li><a href="{{ powerfeed.power_panel.get_absolute_url }}">{{ powerfeed.power_panel }}</a></li> <li><a href="{{ object.power_panel.get_absolute_url }}">{{ object.power_panel }}</a></li>
{% if powerfeed.rack %} {% if object.rack %}
<li><a href="{{ powerfeed.rack.get_absolute_url }}">{{ powerfeed.rack }}</a></li> <li><a href="{{ object.rack.get_absolute_url }}">{{ object.rack }}</a></li>
{% endif %} {% endif %}
<li>{{ powerfeed }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -32,29 +32,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons powerfeed %} {% plugin_buttons object %}
{% if perms.dcim.add_powerfeed %} {% if perms.dcim.add_powerfeed %}
{% clone_button powerfeed %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.dcim.change_powerfeed %} {% if perms.dcim.change_powerfeed %}
{% edit_button powerfeed %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_powerfeed %} {% if perms.dcim.delete_powerfeed %}
{% delete_button powerfeed %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ powerfeed }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=powerfeed %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links powerfeed %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ powerfeed.get_absolute_url }}">Cable</a> <a href="{{ object.get_absolute_url }}">Cable</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:powerfeed_changelog' pk=powerfeed.pk %}">Change Log</a> <a href="{% url 'dcim:powerfeed_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -71,14 +71,14 @@
<tr> <tr>
<td>Power Panel</td> <td>Power Panel</td>
<td> <td>
<a href="{{ powerfeed.power_panel.get_absolute_url }}">{{ powerfeed.power_panel }}</a> <a href="{{ object.power_panel.get_absolute_url }}">{{ object.power_panel }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Rack</td> <td>Rack</td>
<td> <td>
{% if powerfeed.rack %} {% if object.rack %}
<a href="{{ powerfeed.rack.get_absolute_url }}">{{ powerfeed.rack }}</a> <a href="{{ object.rack.get_absolute_url }}">{{ object.rack }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -87,20 +87,20 @@
<tr> <tr>
<td>Type</td> <td>Type</td>
<td> <td>
<span class="label label-{{ powerfeed.get_type_class }}">{{ powerfeed.get_type_display }}</span> <span class="label label-{{ object.get_type_class }}">{{ object.get_type_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ powerfeed.get_status_class }}">{{ powerfeed.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Connected Device</td> <td>Connected Device</td>
<td> <td>
{% if powerfeed.connected_endpoint %} {% if object.connected_endpoint %}
<a href="{{ powerfeed.connected_endpoint.device.get_absolute_url }}">{{ powerfeed.connected_endpoint.device }}</a> ({{ powerfeed.connected_endpoint }}) <a href="{{ object.connected_endpoint.device.get_absolute_url }}">{{ object.connected_endpoint.device }}</a> ({{ object.connected_endpoint }})
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -108,12 +108,12 @@
</tr> </tr>
<tr> <tr>
<td>Utilization (Allocated)</td> <td>Utilization (Allocated)</td>
{% with utilization=powerfeed.connected_endpoint.get_power_draw %} {% with utilization=object.connected_endpoint.get_power_draw %}
{% if utilization %} {% if utilization %}
<td> <td>
{{ utilization.allocated }}VA / {{ powerfeed.available_power }}VA {{ utilization.allocated }}VA / {{ object.available_power }}VA
{% if powerfeed.available_power > 0 %} {% if object.available_power > 0 %}
{% utilization_graph utilization.allocated|percentage:powerfeed.available_power %} {% utilization_graph utilization.allocated|percentage:object.available_power %}
{% endif %} {% endif %}
</td> </td>
{% else %} {% else %}
@ -130,71 +130,71 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Supply</td> <td>Supply</td>
<td>{{ powerfeed.get_supply_display }}</td> <td>{{ object.get_supply_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Voltage</td> <td>Voltage</td>
<td>{{ powerfeed.voltage }}V</td> <td>{{ object.voltage }}V</td>
</tr> </tr>
<tr> <tr>
<td>Amperage</td> <td>Amperage</td>
<td>{{ powerfeed.amperage }}A</td> <td>{{ object.amperage }}A</td>
</tr> </tr>
<tr> <tr>
<td>Phase</td> <td>Phase</td>
<td>{{ powerfeed.get_phase_display }}</td> <td>{{ object.get_phase_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Max Utilization</td> <td>Max Utilization</td>
<td>{{ powerfeed.max_utilization }}%</td> <td>{{ object.max_utilization }}%</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=powerfeed %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=powerfeed.tags.all url='dcim:powerfeed_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:powerfeed_list' %}
{% plugin_left_page powerfeed %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if powerfeed.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ powerfeed.cable.get_absolute_url }}">{{ powerfeed.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:consoleport_trace' pk=powerfeed.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:consoleport_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
</tr> </tr>
{% if powerfeed.connected_endpoint %} {% if object.connected_endpoint %}
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ powerfeed.connected_endpoint.device.get_absolute_url }}">{{ powerfeed.connected_endpoint.device }}</a> <a href="{{ object.connected_endpoint.device.get_absolute_url }}">{{ object.connected_endpoint.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td> <td>
<a href="{{ powerfeed.connected_endpoint.get_absolute_url }}">{{ powerfeed.connected_endpoint.name }}</a> <a href="{{ object.connected_endpoint.get_absolute_url }}">{{ object.connected_endpoint.name }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ powerfeed.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ object.connected_endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ powerfeed.connected_endpoint.description|placeholder }}</td> <td>{{ object.connected_endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Path Status</td> <td>Path Status</td>
<td> <td>
{% if powerfeed.path.is_active %} {% if object.path.is_active %}
<span class="label label-success">Reachable</span> <span class="label label-success">Reachable</span>
{% else %} {% else %}
<span class="label label-danger">Not Reachable</span> <span class="label label-danger">Not Reachable</span>
@ -206,7 +206,7 @@
{% else %} {% else %}
<div class="panel-body text-muted"> <div class="panel-body text-muted">
{% if perms.dcim.add_cable %} {% if perms.dcim.add_cable %}
<a href="{% url 'dcim:powerfeed_connect' termination_a_id=powerfeed.pk termination_b_type='power-port' %}?return_url={{ powerfeed.get_absolute_url }}" class="btn btn-primary btn-sm pull-right"> <a href="{% url 'dcim:powerfeed_connect' termination_a_id=object.pk termination_b_type='power-port' %}?return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-sm pull-right">
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</a> </a>
{% endif %} {% endif %}
@ -219,19 +219,19 @@
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if powerfeed.comments %} {% if object.comments %}
{{ powerfeed.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_right_page powerfeed %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page powerfeed %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -13,79 +13,79 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.get_type_display }}</td> <td>{{ object.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Power Port</td> <td>Power Port</td>
<td>{{ instance.power_port }}</td> <td>{{ object.power_port }}</td>
</tr> </tr>
<tr> <tr>
<td>Feed Leg</td> <td>Feed Leg</td>
<td>{{ instance.get_feed_leg_display }}</td> <td>{{ object.get_feed_leg_display }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if instance.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:poweroutlet_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:poweroutlet_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
</tr> </tr>
{% if instance.connected_endpoint %} {% if object.connected_endpoint %}
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a> <a href="{{ object.connected_endpoint.device.get_absolute_url }}">{{ object.connected_endpoint.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td> <td>
<a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a> <a href="{{ object.connected_endpoint.get_absolute_url }}">{{ object.connected_endpoint.name }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ object.connected_endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.connected_endpoint.description|placeholder }}</td> <td>{{ object.connected_endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Path Status</td> <td>Path Status</td>
<td> <td>
{% if instance.path.is_active %} {% if object.path.is_active %}
<span class="label label-success">Reachable</span> <span class="label label-success">Reachable</span>
{% else %} {% else %}
<span class="label label-danger">Not Reachable</span> <span class="label label-danger">Not Reachable</span>
@ -98,19 +98,19 @@
<div class="panel-body text-muted"> <div class="panel-body text-muted">
Not connected Not connected
{% if perms.dcim.add_cable %} {% if perms.dcim.add_cable %}
<a href="{% url 'dcim:poweroutlet_connect' termination_a_id=instance.pk termination_b_type='power-port' %}?return_url={{ instance.get_absolute_url }}" title="Connect" class="btn btn-primary btn-sm pull-right"> <a href="{% url 'dcim:poweroutlet_connect' termination_a_id=object.pk termination_b_type='power-port' %}?return_url={{ object.get_absolute_url }}" title="Connect" class="btn btn-primary btn-sm pull-right">
<i class="mdi mdi-ethernet-cable" aria-hidden="true"></i> Connect <i class="mdi mdi-ethernet-cable" aria-hidden="true"></i> Connect
</a> </a>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -10,11 +10,11 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:powerpanel_list' %}">Power Panels</a></li> <li><a href="{% url 'dcim:powerpanel_list' %}">Power Panels</a></li>
<li><a href="{{ powerpanel.site.get_absolute_url }}">{{ powerpanel.site }}</a></li> <li><a href="{{ object.site.get_absolute_url }}">{{ object.site }}</a></li>
{% if powerpanel.rack_group %} {% if object.rack_group %}
<li><a href="{{ powerpanel.rack_group.get_absolute_url }}">{{ powerpanel.rack_group }}</a></li> <li><a href="{{ object.rack_group.get_absolute_url }}">{{ object.rack_group }}</a></li>
{% endif %} {% endif %}
<li>{{ powerpanel }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -31,26 +31,26 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons powerpanel %} {% plugin_buttons object %}
{% if perms.dcim.change_powerpanel %} {% if perms.dcim.change_powerpanel %}
{% edit_button powerpanel %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_powerpanel %} {% if perms.dcim.delete_powerpanel %}
{% delete_button powerpanel %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ powerpanel }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=powerpanel %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links powerpanel %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ powerpanel.get_absolute_url }}">Cable</a> <a href="{{ object.get_absolute_url }}">Cable</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:powerpanel_changelog' pk=powerpanel.pk %}">Change Log</a> <a href="{% url 'dcim:powerpanel_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -67,14 +67,14 @@
<tr> <tr>
<td>Site</td> <td>Site</td>
<td> <td>
<a href="{{ powerpanel.site.get_absolute_url }}">{{ powerpanel.site }}</a> <a href="{{ object.site.get_absolute_url }}">{{ object.site }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Rack Group</td> <td>Rack Group</td>
<td> <td>
{% if powerpanel.rack_group %} {% if object.rack_group %}
<a href="{{ powerpanel.rack_group.get_absolute_url }}">{{ powerpanel.rack_group }}</a> <a href="{{ object.rack_group.get_absolute_url }}">{{ object.rack_group }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -82,18 +82,18 @@
</tr> </tr>
</table> </table>
</div> </div>
{% plugin_left_page powerpanel %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'inc/custom_fields_panel.html' with obj=powerpanel %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=powerpanel.tags.all url='dcim:powerpanel_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:powerpanel_list' %}
{% plugin_right_page powerpanel %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% include 'panel_table.html' with table=powerfeed_table heading='Connected Feeds' %} {% include 'panel_table.html' with table=powerfeed_table heading='Connected Feeds' %}
{% plugin_full_width_page powerpanel %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -13,79 +13,79 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.get_type_display }}</td> <td>{{ object.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Maximum Draw</td> <td>Maximum Draw</td>
<td>{{ instance.maximum_draw|placeholder }}</td> <td>{{ object.maximum_draw|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Allocated Draw</td> <td>Allocated Draw</td>
<td>{{ instance.allocated_draw|placeholder }}</td> <td>{{ object.allocated_draw|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if instance.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:powerport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:powerport_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
</tr> </tr>
{% if instance.connected_endpoint %} {% if object.connected_endpoint %}
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a> <a href="{{ object.connected_endpoint.device.get_absolute_url }}">{{ object.connected_endpoint.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td> <td>
<a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a> <a href="{{ object.connected_endpoint.get_absolute_url }}">{{ object.connected_endpoint.name }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ object.connected_endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.connected_endpoint.description|placeholder }}</td> <td>{{ object.connected_endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Path Status</td> <td>Path Status</td>
<td> <td>
{% if instance.path.is_active %} {% if object.path.is_active %}
<span class="label label-success">Reachable</span> <span class="label label-success">Reachable</span>
{% else %} {% else %}
<span class="label label-danger">Not Reachable</span> <span class="label label-danger">Not Reachable</span>
@ -103,20 +103,20 @@
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:powerport_connect' termination_a_id=instance.pk termination_b_type='power-outlet' %}?return_url={{ instance.get_absolute_url }}">Power Outlet</a></li> <li><a href="{% url 'dcim:powerport_connect' termination_a_id=object.pk termination_b_type='power-outlet' %}?return_url={{ object.get_absolute_url }}">Power Outlet</a></li>
<li><a href="{% url 'dcim:powerport_connect' termination_a_id=instance.pk termination_b_type='power-feed' %}?return_url={{ instance.get_absolute_url }}">Power Feed</a></li> <li><a href="{% url 'dcim:powerport_connect' termination_a_id=object.pk termination_b_type='power-feed' %}?return_url={{ object.get_absolute_url }}">Power Feed</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -10,14 +10,14 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:rack_list' %}">Racks</a></li> <li><a href="{% url 'dcim:rack_list' %}">Racks</a></li>
<li><a href="{% url 'dcim:rack_list' %}?site={{ rack.site.slug }}">{{ rack.site }}</a></li> <li><a href="{% url 'dcim:rack_list' %}?site={{ object.site.slug }}">{{ object.site }}</a></li>
{% if rack.group %} {% if object.group %}
{% for group in rack.group.get_ancestors %} {% for group in object.group.get_ancestors %}
<li><a href="{{ group.get_absolute_url }}">{{ group }}</a></li> <li><a href="{{ group.get_absolute_url }}">{{ group }}</a></li>
{% endfor %} {% endfor %}
<li><a href="{{ rack.group.get_absolute_url }}">{{ rack.group }}</a></li> <li><a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a></li>
{% endif %} {% endif %}
<li>{{ rack }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -34,7 +34,7 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons rack %} {% plugin_buttons object %}
<a {% if prev_rack %}href="{% url 'dcim:rack' pk=prev_rack.pk %}"{% else %}disabled="disabled"{% endif %} class="btn btn-primary"> <a {% if prev_rack %}href="{% url 'dcim:rack' pk=prev_rack.pk %}"{% else %}disabled="disabled"{% endif %} class="btn btn-primary">
<span class="mdi mdi-chevron-left" aria-hidden="true"></span> Previous Rack <span class="mdi mdi-chevron-left" aria-hidden="true"></span> Previous Rack
</a> </a>
@ -42,30 +42,30 @@
<span class="mdi mdi-chevron-right" aria-hidden="true"></span> Next Rack <span class="mdi mdi-chevron-right" aria-hidden="true"></span> Next Rack
</a> </a>
{% if perms.dcim.add_rack %} {% if perms.dcim.add_rack %}
{% clone_button rack %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.dcim.change_rack %} {% if perms.dcim.change_rack %}
{% edit_button rack %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_rack %} {% if perms.dcim.delete_rack %}
{% delete_button rack %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}Rack {{ rack }}{% endblock %}</h1> <h1>{% block title %}Rack {{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=rack %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
<button class="btn btn-sm btn-default toggle-images" selected="selected"> <button class="btn btn-sm btn-default toggle-images" selected="selected">
<span class="mdi mdi-checkbox-marked-circle-outline" aria-hidden="true"></span> Show Images <span class="mdi mdi-checkbox-marked-circle-outline" aria-hidden="true"></span> Show Images
</button> </button>
{% custom_links rack %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ rack.get_absolute_url }}">Rack</a> <a href="{{ object.get_absolute_url }}">Rack</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:rack_changelog' pk=rack.pk %}">Change Log</a> <a href="{% url 'dcim:rack_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -82,20 +82,20 @@
<tr> <tr>
<td>Site</td> <td>Site</td>
<td> <td>
{% if rack.site.region %} {% if object.site.region %}
<a href="{{ rack.site.region.get_absolute_url }}">{{ rack.site.region }}</a> / <a href="{{ object.site.region.get_absolute_url }}">{{ object.site.region }}</a> /
{% endif %} {% endif %}
<a href="{% url 'dcim:site' slug=rack.site.slug %}">{{ rack.site }}</a> <a href="{% url 'dcim:site' slug=object.site.slug %}">{{ object.site }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Group</td> <td>Group</td>
<td> <td>
{% if rack.group %} {% if object.group %}
{% for group in rack.group.get_ancestors %} {% for group in object.group.get_ancestors %}
<a href="{{ group.get_absolute_url }}">{{ group }}</a> / <a href="{{ group.get_absolute_url }}">{{ group }}</a> /
{% endfor %} {% endfor %}
<a href="{{ rack.group.get_absolute_url }}">{{ rack.group }}</a> <a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -103,16 +103,16 @@
</tr> </tr>
<tr> <tr>
<td>Facility ID</td> <td>Facility ID</td>
<td>{{ rack.facility_id|placeholder }}</td> <td>{{ object.facility_id|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if rack.tenant %} {% if object.tenant %}
{% if rack.tenant.group %} {% if object.tenant.group %}
<a href="{{ rack.tenant.group.get_absolute_url }}">{{ rack.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ rack.tenant.get_absolute_url }}">{{ rack.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -121,14 +121,14 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
{{ rack.get_status_display }} {{ object.get_status_display }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Role</td> <td>Role</td>
<td> <td>
{% if rack.role %} {% if object.role %}
<a href="{{ rack.role.get_absolute_url }}">{{ rack.role }}</a> <a href="{{ object.role.get_absolute_url }}">{{ object.role }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -136,25 +136,25 @@
</tr> </tr>
<tr> <tr>
<td>Serial Number</td> <td>Serial Number</td>
<td>{{ rack.serial|placeholder }}</td> <td>{{ object.serial|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Asset Tag</td> <td>Asset Tag</td>
<td>{{ rack.asset_tag|placeholder }}</td> <td>{{ object.asset_tag|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Devices</td> <td>Devices</td>
<td> <td>
<a href="{% url 'dcim:device_list' %}?rack_id={{ rack.id }}">{{ device_count }}</a> <a href="{% url 'dcim:device_list' %}?rack_id={{ object.id }}">{{ device_count }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Space Utilization</td> <td>Space Utilization</td>
<td>{% utilization_graph rack.get_utilization %}</td> <td>{% utilization_graph object.get_utilization %}</td>
</tr> </tr>
<tr> <tr>
<td>Power Utilization</td> <td>Power Utilization</td>
<td>{% utilization_graph rack.get_power_utilization %}</td> <td>{% utilization_graph object.get_power_utilization %}</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -166,8 +166,8 @@
<tr> <tr>
<td>Type</td> <td>Type</td>
<td> <td>
{% if rack.type %} {% if object.type %}
{{ rack.get_type_display }} {{ object.get_type_display }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -175,17 +175,17 @@
</tr> </tr>
<tr> <tr>
<td>Width</td> <td>Width</td>
<td>{{ rack.get_width_display }}</td> <td>{{ object.get_width_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Height</td> <td>Height</td>
<td>{{ rack.u_height }}U ({% if rack.desc_units %}descending{% else %}ascending{% endif %})</td> <td>{{ object.u_height }}U ({% if object.desc_units %}descending{% else %}ascending{% endif %})</td>
</tr> </tr>
<tr> <tr>
<td>Outer Width</td> <td>Outer Width</td>
<td> <td>
{% if rack.outer_width %} {% if object.outer_width %}
<span>{{ rack.outer_width }} {{ rack.get_outer_unit_display }}</span> <span>{{ object.outer_width }} {{ object.get_outer_unit_display }}</span>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -194,8 +194,8 @@
<tr> <tr>
<td>Outer Depth</td> <td>Outer Depth</td>
<td> <td>
{% if rack.outer_depth %} {% if object.outer_depth %}
<span>{{ rack.outer_depth }} {{ rack.get_outer_unit_display }}</span> <span>{{ object.outer_depth }} {{ object.get_outer_unit_display }}</span>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -203,15 +203,15 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=rack %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=rack.tags.all url='dcim:rack_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:rack_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if rack.comments %} {% if object.comments %}
{{ rack.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -260,10 +260,10 @@
<div class="panel-heading"> <div class="panel-heading">
<strong>Images</strong> <strong>Images</strong>
</div> </div>
{% include 'inc/image_attachments.html' with images=rack.images.all %} {% include 'inc/image_attachments.html' with images=object.images.all %}
{% if perms.extras.add_imageattachment %} {% if perms.extras.add_imageattachment %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'dcim:rack_add_image' object_id=rack.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:rack_add_image' object_id=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Attach an image Attach an image
</a> </a>
@ -300,12 +300,12 @@
</td> </td>
<td class="text-right noprint"> <td class="text-right noprint">
{% if perms.dcim.change_rackreservation %} {% if perms.dcim.change_rackreservation %}
<a href="{% url 'dcim:rackreservation_edit' pk=resv.pk %}?return_url={{ rack.get_absolute_url }}" class="btn btn-warning btn-xs" title="Edit reservation"> <a href="{% url 'dcim:rackreservation_edit' pk=resv.pk %}?return_url={{ object.get_absolute_url }}" class="btn btn-warning btn-xs" title="Edit reservation">
<i class="mdi mdi-pencil" aria-hidden="true"></i> <i class="mdi mdi-pencil" aria-hidden="true"></i>
</a> </a>
{% endif %} {% endif %}
{% if perms.dcim.delete_rackreservation %} {% if perms.dcim.delete_rackreservation %}
<a href="{% url 'dcim:rackreservation_delete' pk=resv.pk %}?return_url={{ rack.get_absolute_url }}" class="btn btn-danger btn-xs" title="Delete reservation"> <a href="{% url 'dcim:rackreservation_delete' pk=resv.pk %}?return_url={{ object.get_absolute_url }}" class="btn btn-danger btn-xs" title="Delete reservation">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i>
</a> </a>
{% endif %} {% endif %}
@ -318,14 +318,14 @@
{% endif %} {% endif %}
{% if perms.dcim.add_rackreservation %} {% if perms.dcim.add_rackreservation %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'dcim:rackreservation_add' %}?rack={{ rack.pk }}&return_url={{ rack.get_absolute_url }}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:rackreservation_add' %}?rack={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Add a reservation Add a reservation
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_left_page rack %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="row" style="margin-bottom: 20px"> <div class="row" style="margin-bottom: 20px">
@ -371,19 +371,19 @@
{% endif %} {% endif %}
{% if perms.dcim.add_device %} {% if perms.dcim.add_device %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'dcim:device_add' %}?site={{ rack.site.pk }}&rack={{ rack.pk }}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:device_add' %}?site={{ object.site.pk }}&rack={{ object.pk }}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Add a non-racked device Add a non-racked device
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page rack %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page rack %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -10,8 +10,8 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:rackreservation_list' %}">Rack Reservations</a></li> <li><a href="{% url 'dcim:rackreservation_list' %}">Rack Reservations</a></li>
<li><a href="{{ rackreservation.rack.get_absolute_url }}">{{ rackreservation.rack }}</a></li> <li><a href="{{ object.rack.get_absolute_url }}">{{ object.rack }}</a></li>
<li>Units {{ rackreservation.unit_list }}</li> <li>Units {{ object.unit_list }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -28,26 +28,26 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons rackreservation %} {% plugin_buttons object %}
{% if perms.dcim.change_rackreservation %} {% if perms.dcim.change_rackreservation %}
{% edit_button rackreservation %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_rackreservation %} {% if perms.dcim.delete_rackreservation %}
{% delete_button rackreservation %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ rackreservation }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=rackreservation %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links rackreservation %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ rackreservation.get_absolute_url }}">Rack</a> <a href="{{ object.get_absolute_url }}">Rack</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:rackreservation_changelog' pk=rackreservation.pk %}">Change Log</a> <a href="{% url 'dcim:rackreservation_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -61,7 +61,7 @@
<strong>Rack</strong> <strong>Rack</strong>
</div> </div>
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
{% with rack=rackreservation.rack %} {% with rack=object.rack %}
<tr> <tr>
<td>Site</td> <td>Site</td>
<td> <td>
@ -97,16 +97,16 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Units</td> <td>Units</td>
<td>{{ rackreservation.unit_list }}</td> <td>{{ object.unit_list }}</td>
</tr> </tr>
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if rackreservation.tenant %} {% if object.tenant %}
{% if rackreservation.tenant.group %} {% if object.tenant.group %}
<a href="{{ rackreservation.tenant.group.get_absolute_url }}">{{ rackreservation.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ rackreservation.tenant.get_absolute_url }}">{{ rackreservation.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -114,20 +114,20 @@
</tr> </tr>
<tr> <tr>
<td>User</td> <td>User</td>
<td>{{ rackreservation.user }}</td> <td>{{ object.user }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ rackreservation.description }}</td> <td>{{ object.description }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=rackreservation %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=rackreservation.tags.all url='dcim:rackreservation_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:rackreservation_list' %}
{% plugin_left_page rackreservation %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% with rack=rackreservation.rack %} {% with rack=object.rack %}
<div class="row" style="margin-bottom: 20px"> <div class="row" style="margin-bottom: 20px">
<div class="col-md-6 col-sm-6 col-xs-12"> <div class="col-md-6 col-sm-6 col-xs-12">
<div class="rack_header"> <div class="rack_header">
@ -143,12 +143,12 @@
</div> </div>
</div> </div>
{% endwith %} {% endwith %}
{% plugin_right_page rackreservation %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page rackreservation %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -13,46 +13,46 @@
<tr> <tr>
<td>Device</td> <td>Device</td>
<td> <td>
<a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a> <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ instance.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Label</td> <td>Label</td>
<td>{{ instance.label|placeholder }}</td> <td>{{ object.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ instance.get_type_display }}</td> <td>{{ object.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Positions</td> <td>Positions</td>
<td>{{ instance.positions }}</td> <td>{{ object.positions }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ instance.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_left_page instance %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Connection</strong>
</div> </div>
{% if instance.cable %} {% if object.cable %}
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Cable</td> <td>Cable</td>
<td> <td>
<a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a> <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
<a href="{% url 'dcim:rearport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace"> <a href="{% url 'dcim:rearport_trace' pk=object.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i> <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
</a> </a>
</td> </td>
@ -60,10 +60,10 @@
<tr> <tr>
<td>Connection Status</td> <td>Connection Status</td>
<td> <td>
{% if instance.cable.status %} {% if object.cable.status %}
<span class="label label-success">{{ instance.cable.get_status_display }}</span> <span class="label label-success">{{ object.cable.get_status_display }}</span>
{% else %} {% else %}
<span class="label label-info">{{ instance.cable.get_status_display }}</span> <span class="label label-info">{{ object.cable.get_status_display }}</span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
@ -77,22 +77,22 @@
<span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=instance.pk termination_b_type='interface' %}?return_url={{ instance.get_absolute_url }}">Interface</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=object.pk termination_b_type='interface' %}?return_url={{ object.get_absolute_url }}">Interface</a></li>
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=instance.pk termination_b_type='front-port' %}?return_url={{ instance.get_absolute_url }}">Front Port</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=object.pk termination_b_type='front-port' %}?return_url={{ object.get_absolute_url }}">Front Port</a></li>
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=instance.pk termination_b_type='rear-port' %}?return_url={{ instance.get_absolute_url }}">Rear Port</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=object.pk termination_b_type='rear-port' %}?return_url={{ object.get_absolute_url }}">Rear Port</a></li>
<li><a href="{% url 'dcim:rearport_connect' termination_a_id=instance.pk termination_b_type='circuit-termination' %}?return_url={{ instance.get_absolute_url }}">Circuit Termination</a></li> <li><a href="{% url 'dcim:rearport_connect' termination_a_id=object.pk termination_b_type='circuit-termination' %}?return_url={{ object.get_absolute_url }}">Circuit Termination</a></li>
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page instance %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -11,13 +11,13 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:site_list' %}">Sites</a></li> <li><a href="{% url 'dcim:site_list' %}">Sites</a></li>
{% if site.region %} {% if object.region %}
{% for region in site.region.get_ancestors %} {% for region in object.region.get_ancestors %}
<li><a href="{{ region.get_absolute_url }}">{{ region }}</a></li> <li><a href="{{ region.get_absolute_url }}">{{ region }}</a></li>
{% endfor %} {% endfor %}
<li><a href="{{ site.region.get_absolute_url }}">{{ site.region }}</a></li> <li><a href="{{ object.region.get_absolute_url }}">{{ object.region }}</a></li>
{% endif %} {% endif %}
<li>{{ site }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -34,29 +34,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons site %} {% plugin_buttons object %}
{% if perms.dcim.add_site %} {% if perms.dcim.add_site %}
{% clone_button site %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.dcim.change_site %} {% if perms.dcim.change_site %}
{% edit_button site %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_site %} {% if perms.dcim.delete_site %}
{% delete_button site %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ site }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=site %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links site %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ site.get_absolute_url }}">Site</a> <a href="{{ object.get_absolute_url }}">Site</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:site_changelog' slug=site.slug %}">Change Log</a> <a href="{% url 'dcim:site_changelog' slug=object.slug %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -73,17 +73,17 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ site.get_status_class }}">{{ site.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Region</td> <td>Region</td>
<td> <td>
{% if site.region %} {% if object.region %}
{% for region in site.region.get_ancestors %} {% for region in object.region.get_ancestors %}
<a href="{{ region.get_absolute_url }}">{{ region }}</a> / <a href="{{ region.get_absolute_url }}">{{ region }}</a> /
{% endfor %} {% endfor %}
<a href="{{ site.region.get_absolute_url }}">{{ site.region }}</a> <a href="{{ object.region.get_absolute_url }}">{{ object.region }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -92,11 +92,11 @@
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if site.tenant %} {% if object.tenant %}
{% if site.tenant.group %} {% if object.tenant.group %}
<a href="{{ site.tenant.group.get_absolute_url }}">{{ site.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ site.tenant.get_absolute_url }}">{{ site.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -104,18 +104,18 @@
</tr> </tr>
<tr> <tr>
<td>Facility</td> <td>Facility</td>
<td>{{ site.facility|placeholder }}</td> <td>{{ object.facility|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>AS Number</td> <td>AS Number</td>
<td>{{ site.asn|placeholder }}</td> <td>{{ object.asn|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Time Zone</td> <td>Time Zone</td>
<td> <td>
{% if site.time_zone %} {% if object.time_zone %}
{{ site.time_zone }} (UTC {{ site.time_zone|tzoffset }})<br /> {{ object.time_zone }} (UTC {{ object.time_zone|tzoffset }})<br />
<small class="text-muted">Site time: {% timezone site.time_zone %}{% now "SHORT_DATETIME_FORMAT" %}{% endtimezone %}</small> <small class="text-muted">Site time: {% timezone object.time_zone %}{% now "SHORT_DATETIME_FORMAT" %}{% endtimezone %}</small>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -123,7 +123,7 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ site.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -135,13 +135,13 @@
<tr> <tr>
<td>Physical Address</td> <td>Physical Address</td>
<td> <td>
{% if site.physical_address %} {% if object.physical_address %}
<div class="pull-right noprint"> <div class="pull-right noprint">
<a href="http://maps.google.com/?q={{ site.physical_address|urlencode }}" target="_blank" class="btn btn-primary btn-xs"> <a href="http://maps.google.com/?q={{ object.physical_address|urlencode }}" target="_blank" class="btn btn-primary btn-xs">
<i class="mdi mdi-map-marker"></i> Map it <i class="mdi mdi-map-marker"></i> Map it
</a> </a>
</div> </div>
<span>{{ site.physical_address|linebreaksbr }}</span> <span>{{ object.physical_address|linebreaksbr }}</span>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -149,18 +149,18 @@
</tr> </tr>
<tr> <tr>
<td>Shipping Address</td> <td>Shipping Address</td>
<td>{{ site.shipping_address|linebreaksbr|placeholder }}</td> <td>{{ object.shipping_address|linebreaksbr|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>GPS Coordinates</td> <td>GPS Coordinates</td>
<td> <td>
{% if site.latitude and site.longitude %} {% if object.latitude and object.longitude %}
<div class="pull-right noprint"> <div class="pull-right noprint">
<a href="http://maps.google.com/?q={{ site.latitude }},{{ site.longitude }}" target="_blank" class="btn btn-primary btn-xs"> <a href="http://maps.google.com/?q={{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary btn-xs">
<i class="mdi mdi-map-marker"></i> Map it <i class="mdi mdi-map-marker"></i> Map it
</a> </a>
</div> </div>
<span>{{ site.latitude }}, {{ site.longitude }}</span> <span>{{ object.latitude }}, {{ object.longitude }}</span>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -168,13 +168,13 @@
</tr> </tr>
<tr> <tr>
<td>Contact Name</td> <td>Contact Name</td>
<td>{{ site.contact_name|placeholder }}</td> <td>{{ object.contact_name|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Contact Phone</td> <td>Contact Phone</td>
<td> <td>
{% if site.contact_phone %} {% if object.contact_phone %}
<a href="tel:{{ site.contact_phone }}">{{ site.contact_phone }}</a> <a href="tel:{{ object.contact_phone }}">{{ object.contact_phone }}</a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -183,8 +183,8 @@
<tr> <tr>
<td>Contact E-Mail</td> <td>Contact E-Mail</td>
<td> <td>
{% if site.contact_email %} {% if object.contact_email %}
<a href="mailto:{{ site.contact_email }}">{{ site.contact_email }}</a> <a href="mailto:{{ object.contact_email }}">{{ object.contact_email }}</a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -192,21 +192,21 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=site %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=site.tags.all url='dcim:site_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:site_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if site.comments %} {% if object.comments %}
{{ site.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_left_page site %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<div class="panel panel-default"> <div class="panel panel-default">
@ -215,27 +215,27 @@
</div> </div>
<div class="row panel-body"> <div class="row panel-body">
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'dcim:rack_list' %}?site={{ site.slug }}" class="btn {% if stats.rack_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.rack_count }}</a></h2> <h2><a href="{% url 'dcim:rack_list' %}?site={{ object.slug }}" class="btn {% if stats.rack_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.rack_count }}</a></h2>
<p>Racks</p> <p>Racks</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'dcim:device_list' %}?site={{ site.slug }}" class="btn {% if stats.device_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.device_count }}</a></h2> <h2><a href="{% url 'dcim:device_list' %}?site={{ object.slug }}" class="btn {% if stats.device_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.device_count }}</a></h2>
<p>Devices</p> <p>Devices</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'ipam:prefix_list' %}?site={{ site.slug }}" class="btn {% if stats.prefix_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2> <h2><a href="{% url 'ipam:prefix_list' %}?site={{ object.slug }}" class="btn {% if stats.prefix_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2>
<p>Prefixes</p> <p>Prefixes</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'ipam:vlan_list' %}?site={{ site.slug }}" class="btn {% if stats.vlan_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vlan_count }}</a></h2> <h2><a href="{% url 'ipam:vlan_list' %}?site={{ object.slug }}" class="btn {% if stats.vlan_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vlan_count }}</a></h2>
<p>VLANs</p> <p>VLANs</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'circuits:circuit_list' %}?site={{ site.slug }}" class="btn {% if stats.circuit_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.circuit_count }}</a></h2> <h2><a href="{% url 'circuits:circuit_list' %}?site={{ object.slug }}" class="btn {% if stats.circuit_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.circuit_count }}</a></h2>
<p>Circuits</p> <p>Circuits</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'virtualization:virtualmachine_list' %}?site={{ site.slug }}" class="btn {% if stats.vm_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vm_count }}</a></h2> <h2><a href="{% url 'virtualization:virtualmachine_list' %}?site={{ object.slug }}" class="btn {% if stats.vm_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vm_count }}</a></h2>
<p>Virtual Machines</p> <p>Virtual Machines</p>
</div> </div>
</div> </div>
@ -260,7 +260,7 @@
<td><i class="mdi mdi-folder-open"></i> All racks</td> <td><i class="mdi mdi-folder-open"></i> All racks</td>
<td>{{ stats.rack_count }}</td> <td>{{ stats.rack_count }}</td>
<td class="text-right noprint"> <td class="text-right noprint">
<a href="{% url 'dcim:rack_elevation_list' %}?site={{ site.slug }}" class="btn btn-xs btn-primary" title="View elevations"> <a href="{% url 'dcim:rack_elevation_list' %}?site={{ object.slug }}" class="btn btn-xs btn-primary" title="View elevations">
<i class="mdi mdi-server"></i> <i class="mdi mdi-server"></i>
</a> </a>
</td> </td>
@ -271,22 +271,22 @@
<div class="panel-heading"> <div class="panel-heading">
<strong>Images</strong> <strong>Images</strong>
</div> </div>
{% include 'inc/image_attachments.html' with images=site.images.all %} {% include 'inc/image_attachments.html' with images=object.images.all %}
{% if perms.extras.add_imageattachment %} {% if perms.extras.add_imageattachment %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'dcim:site_add_image' object_id=site.pk %}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:site_add_image' object_id=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Attach an image Attach an image
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page site %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page site %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,10 +9,10 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'dcim:virtualchassis_list' %}">Virtual Chassis</a></li> <li><a href="{% url 'dcim:virtualchassis_list' %}">Virtual Chassis</a></li>
{% if virtualchassis.master %} {% if object.master %}
<li><a href="{% url 'dcim:virtualchassis_list' %}?site={{ virtualchassis.master.site.slug }}">{{ virtualchassis.master.site }}</a></li> <li><a href="{% url 'dcim:virtualchassis_list' %}?site={{ object.master.site.slug }}">{{ object.master.site }}</a></li>
{% endif %} {% endif %}
<li>{{ virtualchassis }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -29,26 +29,26 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons virtualchassis %} {% plugin_buttons object %}
{% if perms.dcim.change_virtualchassis %} {% if perms.dcim.change_virtualchassis %}
{% edit_button virtualchassis %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_virtualchassis %} {% if perms.dcim.delete_virtualchassis %}
{% delete_button virtualchassis %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ virtualchassis }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=virtualchassis %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links virtualchassis %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ virtualchassis.get_absolute_url }}">Virtual Chassis</a> <a href="{{ object.get_absolute_url }}">Virtual Chassis</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'dcim:virtualchassis_changelog' pk=virtualchassis.pk %}">Change Log</a> <a href="{% url 'dcim:virtualchassis_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -64,13 +64,13 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Domain</td> <td>Domain</td>
<td>{{ virtualchassis.domain|placeholder }}</td> <td>{{ object.domain|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Master</td> <td>Master</td>
<td> <td>
{% if virtualchassis.master %} {% if object.master %}
<a href="{{ virtualchassis.master.get_absolute_url }}">{{ virtualchassis.master }}</a> <a href="{{ object.master.get_absolute_url }}">{{ object.master }}</a>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -78,9 +78,9 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=virtualchassis %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=virtualchassis.tags.all url='dcim:virtualchassis_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:virtualchassis_list' %}
{% plugin_left_page virtualchassis %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<div class="panel panel-default"> <div class="panel panel-default">
@ -100,25 +100,25 @@
<a href="{{ vc_member.get_absolute_url }}">{{ vc_member }}</a> <a href="{{ vc_member.get_absolute_url }}">{{ vc_member }}</a>
</td> </td>
<td><span class="badge badge-default">{{ vc_member.vc_position }}</span></td> <td><span class="badge badge-default">{{ vc_member.vc_position }}</span></td>
<td>{% if virtualchassis.master == vc_member %}<i class="mdi mdi-check-bold text-success"></i>{% endif %}</td> <td>{% if object.master == vc_member %}<i class="mdi mdi-check-bold text-success"></i>{% endif %}</td>
<td>{{ vc_member.vc_priority|placeholder }}</td> <td>{{ vc_member.vc_priority|placeholder }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if perms.dcim.change_virtualchassis %} {% if perms.dcim.change_virtualchassis %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'dcim:virtualchassis_add_member' pk=virtualchassis.pk %}?site={{ virtualchassis.master.site.pk }}&rack={{ virtualchassis.master.rack.pk }}" class="btn btn-primary btn-xs"> <a href="{% url 'dcim:virtualchassis_add_member' pk=object.pk %}?site={{ object.master.site.pk }}&rack={{ object.master.rack.pk }}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Member <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Member
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page virtualchassis %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page virtualchassis %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -7,7 +7,7 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'extras:configcontext_list' %}">Config Contexts</a></li> <li><a href="{% url 'extras:configcontext_list' %}">Config Contexts</a></li>
<li>{{ configcontext }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -25,7 +25,7 @@
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% if perms.extras.change_configcontext %} {% if perms.extras.change_configcontext %}
<a href="{% url 'extras:configcontext_edit' pk=configcontext.pk %}" class="btn btn-warning"> <a href="{% url 'extras:configcontext_edit' pk=object.pk %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> <span class="mdi mdi-pencil" aria-hidden="true"></span>
Edit this config context Edit this config context
</a> </a>
@ -33,15 +33,15 @@
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ configcontext.get_absolute_url }}">Config Context</a> <a href="{{ object.get_absolute_url }}">Config Context</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'extras:configcontext_changelog' pk=configcontext.pk %}">Change Log</a> <a href="{% url 'extras:configcontext_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
<h1>{% block title %}{{ configcontext }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -55,23 +55,23 @@
<tr> <tr>
<td>Name</td> <td>Name</td>
<td> <td>
{{ configcontext.name }} {{ object.name }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Weight</td> <td>Weight</td>
<td> <td>
{{ configcontext.weight }} {{ object.weight }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ configcontext.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Active</td> <td>Active</td>
<td> <td>
{% if configcontext.is_active %} {% if object.is_active %}
<span class="text-success"> <span class="text-success">
<i class="mdi mdi-check-bold"></i> <i class="mdi mdi-check-bold"></i>
</span> </span>
@ -92,9 +92,9 @@
<tr> <tr>
<td>Regions</td> <td>Regions</td>
<td> <td>
{% if configcontext.regions.all %} {% if object.regions.all %}
<ul> <ul>
{% for region in configcontext.regions.all %} {% for region in object.regions.all %}
<li><a href="{{ region.get_absolute_url }}">{{ region }}</a></li> <li><a href="{{ region.get_absolute_url }}">{{ region }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -106,9 +106,9 @@
<tr> <tr>
<td>Sites</td> <td>Sites</td>
<td> <td>
{% if configcontext.sites.all %} {% if object.sites.all %}
<ul> <ul>
{% for site in configcontext.sites.all %} {% for site in object.sites.all %}
<li><a href="{{ site.get_absolute_url }}">{{ site }}</a></li> <li><a href="{{ site.get_absolute_url }}">{{ site }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -120,9 +120,9 @@
<tr> <tr>
<td>Roles</td> <td>Roles</td>
<td> <td>
{% if configcontext.roles.all %} {% if object.roles.all %}
<ul> <ul>
{% for role in configcontext.roles.all %} {% for role in object.roles.all %}
<li><a href="{% url 'dcim:device_list' %}?role={{ role.slug }}">{{ role }}</a></li> <li><a href="{% url 'dcim:device_list' %}?role={{ role.slug }}">{{ role }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -134,9 +134,9 @@
<tr> <tr>
<td>Platforms</td> <td>Platforms</td>
<td> <td>
{% if configcontext.platforms.all %} {% if object.platforms.all %}
<ul> <ul>
{% for platform in configcontext.platforms.all %} {% for platform in object.platforms.all %}
<li><a href="{{ platform.get_absolute_url }}">{{ platform }}</a></li> <li><a href="{{ platform.get_absolute_url }}">{{ platform }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -148,9 +148,9 @@
<tr> <tr>
<td>Cluster Groups</td> <td>Cluster Groups</td>
<td> <td>
{% if configcontext.cluster_groups.all %} {% if object.cluster_groups.all %}
<ul> <ul>
{% for cluster_group in configcontext.cluster_groups.all %} {% for cluster_group in object.cluster_groups.all %}
<li><a href="{{ cluster_group.get_absolute_url }}">{{ cluster_group }}</a></li> <li><a href="{{ cluster_group.get_absolute_url }}">{{ cluster_group }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -162,9 +162,9 @@
<tr> <tr>
<td>Clusters</td> <td>Clusters</td>
<td> <td>
{% if configcontext.clusters.all %} {% if object.clusters.all %}
<ul> <ul>
{% for cluster in configcontext.clusters.all %} {% for cluster in object.clusters.all %}
<li><a href="{{ cluster.get_absolute_url }}">{{ cluster }}</a></li> <li><a href="{{ cluster.get_absolute_url }}">{{ cluster }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -176,9 +176,9 @@
<tr> <tr>
<td>Tenant Groups</td> <td>Tenant Groups</td>
<td> <td>
{% if configcontext.tenant_groups.all %} {% if object.tenant_groups.all %}
<ul> <ul>
{% for tenant_group in configcontext.tenant_groups.all %} {% for tenant_group in object.tenant_groups.all %}
<li><a href="{{ tenant_group.get_absolute_url }}">{{ tenant_group }}</a></li> <li><a href="{{ tenant_group.get_absolute_url }}">{{ tenant_group }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -190,9 +190,9 @@
<tr> <tr>
<td>Tenants</td> <td>Tenants</td>
<td> <td>
{% if configcontext.tenants.all %} {% if object.tenants.all %}
<ul> <ul>
{% for tenant in configcontext.tenants.all %} {% for tenant in object.tenants.all %}
<li><a href="{{ tenant.get_absolute_url }}">{{ tenant }}</a></li> <li><a href="{{ tenant.get_absolute_url }}">{{ tenant }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -204,9 +204,9 @@
<tr> <tr>
<td>Tags</td> <td>Tags</td>
<td> <td>
{% if configcontext.tags.all %} {% if object.tags.all %}
<ul> <ul>
{% for tag in configcontext.tags.all %} {% for tag in object.tags.all %}
<li><a href="{{ tag.get_absolute_url }}">{{ tag }}</a></li> <li><a href="{{ tag.get_absolute_url }}">{{ tag }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -225,7 +225,7 @@
{% include 'extras/inc/configcontext_format.html' %} {% include 'extras/inc/configcontext_format.html' %}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% include 'extras/inc/configcontext_data.html' with data=configcontext.data format=format %} {% include 'extras/inc/configcontext_data.html' with data=object.data format=format %}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,9 +1,8 @@
{% extends base_template %} {% extends base_template %}
{% block title %}{% if obj %}{{ obj }}{% else %}{{ block.super }}{% endif %} - Change Log{% endblock %} {% block title %}{{ block.super }} - Change Log{% endblock %}
{% block content %} {% block content %}
{% if obj %}<h1>{{ obj }}</h1>{% endif %}
{% include 'panel_table.html' %} {% include 'panel_table.html' %}
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %} {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
<div class="text-muted"> <div class="text-muted">

View File

@ -23,8 +23,8 @@
<strong>Local Context</strong> <strong>Local Context</strong>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% if obj.local_context_data %} {% if object.local_context_data %}
{% include 'extras/inc/configcontext_data.html' with data=obj.local_context_data format=format %} {% include 'extras/inc/configcontext_data.html' with data=object.local_context_data format=format %}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}

View File

@ -1,21 +1,21 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load helpers %} {% load helpers %}
{% block title %}{{ objectchange }}{% endblock %} {% block title %}{{ object }}{% endblock %}
{% block header %} {% block header %}
<div class="row noprint"> <div class="row noprint">
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'extras:objectchange_list' %}">Change Log</a></li> <li><a href="{% url 'extras:objectchange_list' %}">Change Log</a></li>
{% if objectchange.related_object.get_absolute_url %} {% if object.related_object.get_absolute_url %}
<li><a href="{{ objectchange.related_object.get_absolute_url }}changelog/">{{ objectchange.related_object }}</a></li> <li><a href="{{ object.related_object.get_absolute_url }}changelog/">{{ object.related_object }}</a></li>
{% elif objectchange.changed_object.get_absolute_url %} {% elif object.changed_object.get_absolute_url %}
<li><a href="{{ objectchange.changed_object.get_absolute_url }}changelog/">{{ objectchange.changed_object }}</a></li> <li><a href="{{ object.changed_object.get_absolute_url }}changelog/">{{ object.changed_object }}</a></li>
{% elif objectchange.changed_object %} {% elif object.changed_object %}
<li>{{ objectchange.changed_object }}</li> <li>{{ object.changed_object }}</li>
{% endif %} {% endif %}
<li>{{ objectchange }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -44,41 +44,41 @@
<tr> <tr>
<td>Time</td> <td>Time</td>
<td> <td>
{{ objectchange.time }} {{ object.time }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>User</td> <td>User</td>
<td> <td>
{{ objectchange.user|default:objectchange.user_name }} {{ object.user|default:object.user_name }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Action</td> <td>Action</td>
<td> <td>
{{ objectchange.get_action_display }} {{ object.get_action_display }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Object Type</td> <td>Object Type</td>
<td> <td>
{{ objectchange.changed_object_type }} {{ object.changed_object_type }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Object</td> <td>Object</td>
<td> <td>
{% if objectchange.changed_object.get_absolute_url %} {% if object.changed_object.get_absolute_url %}
<a href="{{ objectchange.changed_object.get_absolute_url }}">{{ objectchange.changed_object }}</a> <a href="{{ object.changed_object.get_absolute_url }}">{{ object.changed_object }}</a>
{% else %} {% else %}
{{ objectchange.object_repr }} {{ object.object_repr }}
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Request ID</td> <td>Request ID</td>
<td> <td>
{{ objectchange.request_id }} {{ object.request_id }}
</td> </td>
</tr> </tr>
</table> </table>
@ -98,9 +98,9 @@
<div class="panel-body"> <div class="panel-body">
{% if diff_added == diff_removed %} {% if diff_added == diff_removed %}
<span class="text-muted" style="margin-left: 10px;"> <span class="text-muted" style="margin-left: 10px;">
{% if objectchange.action == 'create' %} {% if object.action == 'create' %}
Object created Object created
{% elif objectchange.action == 'delete' %} {% elif object.action == 'delete' %}
Object deleted Object deleted
{% else %} {% else %}
No changes No changes
@ -119,7 +119,7 @@
<strong>Object Data</strong> <strong>Object Data</strong>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<pre>{{ objectchange.object_data|render_json }}</pre> <pre>{{ object.object_data|render_json }}</pre>
</div> </div>
</div> </div>
</div> </div>
@ -129,7 +129,7 @@
{% include 'panel_table.html' with table=related_changes_table heading='Related Changes' panel_class='default' %} {% include 'panel_table.html' with table=related_changes_table heading='Related Changes' panel_class='default' %}
{% if related_changes_count > related_changes_table.rows|length %} {% if related_changes_count > related_changes_table.rows|length %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'extras:objectchange_list' %}?request_id={{ objectchange.request_id }}" class="btn btn-primary">See all {{ related_changes_count|add:"1" }} changes</a> <a href="{% url 'extras:objectchange_list' %}?request_id={{ object.request_id }}" class="btn btn-primary">See all {{ related_changes_count|add:"1" }} changes</a>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -6,7 +6,7 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'extras:tag_list' %}">Tags</a></li> <li><a href="{% url 'extras:tag_list' %}">Tags</a></li>
<li>{{ tag }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -24,27 +24,27 @@
</div> </div>
<div class="pull-right"> <div class="pull-right">
{% if perms.taggit.change_tag %} {% if perms.taggit.change_tag %}
<a href="{% url 'extras:tag_edit' slug=tag.slug %}" class="btn btn-warning"> <a href="{% url 'extras:tag_edit' slug=object.slug %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> <span class="mdi mdi-pencil" aria-hidden="true"></span>
Edit this tag Edit this tag
</a> </a>
{% endif %} {% endif %}
{% if perms.taggit.delete_tag %} {% if perms.taggit.delete_tag %}
<a href="{% url 'extras:tag_delete' slug=tag.slug %}" class="btn btn-danger"> <a href="{% url 'extras:tag_delete' slug=object.slug %}" class="btn btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span>
Delete this tag Delete this tag
</a> </a>
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}Tag: {{ tag }}{% endblock %}</h1> <h1>{% block title %}Tag: {{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=tag %} {% include 'inc/created_updated.html' %}
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ tag.get_absolute_url }}">Tag</a> <a href="{{ object.get_absolute_url }}">Tag</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'extras:tag_changelog' slug=tag.slug %}">Change Log</a> <a href="{% url 'extras:tag_changelog' slug=object.slug %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -61,13 +61,13 @@
<tr> <tr>
<td>Name</td> <td>Name</td>
<td> <td>
{{ tag.name }} {{ object.name }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Slug</td> <td>Slug</td>
<td> <td>
{{ tag.slug }} {{ object.slug }}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -79,13 +79,13 @@
<tr> <tr>
<td>Color</td> <td>Color</td>
<td> <td>
<span class="label color-block" style="background-color: #{{ tag.color }}">&nbsp;</span> <span class="label color-block" style="background-color: #{{ object.color }}">&nbsp;</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td> <td>
{{ tag.description|placeholder }} {{ object.description|placeholder }}
</td> </td>
</table> </table>
</div> </div>

View File

@ -1,3 +1,3 @@
<p> <p>
<small class="text-muted">Created {{ obj.created }} &middot; Updated <span title="{{ obj.last_updated }}">{{ obj.last_updated|timesince }}</span> ago</small> <small class="text-muted">Created {{ object.created }} &middot; Updated <span title="{{ object.last_updated }}">{{ object.last_updated|timesince }}</span> ago</small>
</p> </p>

View File

@ -1,4 +1,4 @@
{% with custom_fields=obj.get_custom_fields %} {% with custom_fields=object.get_custom_fields %}
{% if custom_fields %} {% if custom_fields %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">

View File

@ -9,8 +9,8 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:aggregate_list' %}">Aggregates</a></li> <li><a href="{% url 'ipam:aggregate_list' %}">Aggregates</a></li>
<li><a href="{% url 'ipam:aggregate_list' %}?rir={{ aggregate.rir.slug }}">{{ aggregate.rir }}</a></li> <li><a href="{% url 'ipam:aggregate_list' %}?rir={{ object.rir.slug }}">{{ object.rir }}</a></li>
<li>{{ aggregate }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -27,30 +27,30 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons aggregate %} {% plugin_buttons object %}
{% if perms.ipam.add_aggregate %} {% if perms.ipam.add_aggregate %}
{% clone_button aggregate %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.ipam.change_aggregate %} {% if perms.ipam.change_aggregate %}
{% edit_button aggregate %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.ipam.delete_aggregate %} {% if perms.ipam.delete_aggregate %}
{% delete_button aggregate %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ aggregate }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=aggregate %} {% include 'inc/created_updated.html' %}
{% include 'ipam/inc/toggle_available.html' %} {% include 'ipam/inc/toggle_available.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links aggregate %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ aggregate.get_absolute_url }}">Aggregate</a> <a href="{{ object.get_absolute_url }}">Aggregate</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:aggregate_changelog' pk=aggregate.pk %}">Change Log</a> <a href="{% url 'ipam:aggregate_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -66,28 +66,28 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Family</td> <td>Family</td>
<td>IPv{{ aggregate.family }}</td> <td>IPv{{ object.family }}</td>
</tr> </tr>
<tr> <tr>
<td>RIR</td> <td>RIR</td>
<td> <td>
<a href="{% url 'ipam:aggregate_list' %}?rir={{ aggregate.rir.slug }}">{{ aggregate.rir }}</a> <a href="{% url 'ipam:aggregate_list' %}?rir={{ object.rir.slug }}">{{ object.rir }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Utilization</td> <td>Utilization</td>
<td> <td>
{{ aggregate.get_utilization }}% {{ object.get_utilization }}%
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if aggregate.tenant %} {% if object.tenant %}
{% if prefix.aggregate.group %} {% if prefix.object.group %}
<a href="{{ aggregate.tenant.group.get_absolute_url }}">{{ aggregate.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ aggregate.tenant.get_absolute_url }}">{{ aggregate.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -95,25 +95,25 @@
</tr> </tr>
<tr> <tr>
<td>Date Added</td> <td>Date Added</td>
<td>{{ aggregate.date_added|placeholder }}</td> <td>{{ object.date_added|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ aggregate.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% plugin_left_page aggregate %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'inc/custom_fields_panel.html' with obj=aggregate %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=aggregate.tags.all url='ipam:aggregate_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:aggregate_list' %}
{% plugin_right_page aggregate %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page aggregate %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -1,14 +1,14 @@
<div class="pull-right"> <div class="pull-right">
{% if perms.ipam.add_vlan and first_available_vlan %} {% if perms.ipam.add_vlan and first_available_vlan %}
<a href="{% url 'ipam:vlan_add' %}?vid={{ first_available_vlan }}&group={{ vlan_group.pk }}{% if vlan_group.site %}&site={{ vlan_group.site.pk }}{% endif %}" class="btn btn-success"> <a href="{% url 'ipam:vlan_add' %}?vid={{ first_available_vlan }}&group={{ object.pk }}{% if object.site %}&site={{ object.site.pk }}{% endif %}" class="btn btn-success">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add a VLAN <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add a VLAN
</a> </a>
{% endif %} {% endif %}
{% if perms.ipam.change_vlangroup %} {% if perms.ipam.change_vlangroup %}
<a href="{% url 'ipam:vlangroup_edit' pk=vlan_group.pk %}" class="btn btn-warning"> <a href="{% url 'ipam:vlangroup_edit' pk=object.pk %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> <span class="mdi mdi-pencil" aria-hidden="true"></span>
Edit this VLAN Group Edit this VLAN Group
</a> </a>
{% endif %} {% endif %}
</div> </div>
<h1>{{ vlan_group }}</h1> <h1>{{ object }}</h1>

View File

@ -10,10 +10,10 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:ipaddress_list' %}">IP Addresses</a></li> <li><a href="{% url 'ipam:ipaddress_list' %}">IP Addresses</a></li>
{% if ipaddress.vrf %} {% if object.vrf %}
<li><a href="{% url 'ipam:vrf' pk=ipaddress.vrf.pk %}">{{ ipaddress.vrf }}</a></li> <li><a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a></li>
{% endif %} {% endif %}
<li>{{ ipaddress }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -30,29 +30,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons ipaddress %} {% plugin_buttons object %}
{% if perms.ipam.add_ipaddress %} {% if perms.ipam.add_ipaddress %}
{% clone_button ipaddress %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.ipam.change_ipaddress %} {% if perms.ipam.change_ipaddress %}
{%edit_button ipaddress %} {%edit_button object %}
{% endif %} {% endif %}
{% if perms.ipam.delete_ipaddress %} {% if perms.ipam.delete_ipaddress %}
{% delete_button ipaddress %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ ipaddress }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=ipaddress %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links ipaddress %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ ipaddress.get_absolute_url }}">IP Address</a> <a href="{{ object.get_absolute_url }}">IP Address</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:ipaddress_changelog' pk=ipaddress.pk %}">Change Log</a> <a href="{% url 'ipam:ipaddress_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -68,13 +68,13 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Family</td> <td>Family</td>
<td>IPv{{ ipaddress.family }}</td> <td>IPv{{ object.family }}</td>
</tr> </tr>
<tr> <tr>
<td>VRF</td> <td>VRF</td>
<td> <td>
{% if ipaddress.vrf %} {% if object.vrf %}
<a href="{% url 'ipam:vrf' pk=ipaddress.vrf.pk %}">{{ ipaddress.vrf }}</a> <a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a>
{% else %} {% else %}
<span>Global</span> <span>Global</span>
{% endif %} {% endif %}
@ -83,11 +83,11 @@
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if ipaddress.tenant %} {% if object.tenant %}
{% if ipaddress.tenant.group %} {% if object.tenant.group %}
<a href="{{ ipaddress.tenant.group.get_absolute_url }}">{{ ipaddress.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ ipaddress.tenant.get_absolute_url }}">{{ ipaddress.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -96,14 +96,14 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ ipaddress.get_status_class }}">{{ ipaddress.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Role</td> <td>Role</td>
<td> <td>
{% if ipaddress.role %} {% if object.role %}
<a href="{% url 'ipam:ipaddress_list' %}?role={{ ipaddress.role }}">{{ ipaddress.get_role_display }}</a> <a href="{% url 'ipam:ipaddress_list' %}?role={{ object.role }}">{{ object.get_role_display }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -111,17 +111,17 @@
</tr> </tr>
<tr> <tr>
<td>DNS Name</td> <td>DNS Name</td>
<td>{{ ipaddress.dns_name|placeholder }}</td> <td>{{ object.dns_name|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ ipaddress.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Assignment</td> <td>Assignment</td>
<td> <td>
{% if ipaddress.assigned_object %} {% if object.assigned_object %}
<span><a href="{{ ipaddress.assigned_object.parent.get_absolute_url }}">{{ ipaddress.assigned_object.parent }}</a> ({{ ipaddress.assigned_object }})</span> <span><a href="{{ object.assigned_object.parent.get_absolute_url }}">{{ object.assigned_object.parent }}</a> ({{ object.assigned_object }})</span>
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -130,10 +130,10 @@
<tr> <tr>
<td>NAT (inside)</td> <td>NAT (inside)</td>
<td> <td>
{% if ipaddress.nat_inside %} {% if object.nat_inside %}
<a href="{% url 'ipam:ipaddress' pk=ipaddress.nat_inside.pk %}">{{ ipaddress.nat_inside }}</a> <a href="{% url 'ipam:ipaddress' pk=object.nat_inside.pk %}">{{ object.nat_inside }}</a>
{% if ipaddress.nat_inside.assigned_object %} {% if object.nat_inside.assigned_object %}
(<a href="{{ ipaddress.nat_inside.assigned_object.parent.get_absolute_url }}">{{ ipaddress.nat_inside.assigned_object.parent }}</a>) (<a href="{{ object.nat_inside.assigned_object.parent.get_absolute_url }}">{{ object.nat_inside.assigned_object.parent }}</a>)
{% endif %} {% endif %}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
@ -143,8 +143,8 @@
<tr> <tr>
<td>NAT (outside)</td> <td>NAT (outside)</td>
<td> <td>
{% if ipaddress.nat_outside %} {% if object.nat_outside %}
<a href="{% url 'ipam:ipaddress' pk=ipaddress.nat_outside.pk %}">{{ ipaddress.nat_outside }}</a> <a href="{% url 'ipam:ipaddress' pk=object.nat_outside.pk %}">{{ object.nat_outside }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -152,9 +152,9 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=ipaddress %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=ipaddress.tags.all url='ipam:ipaddress_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:ipaddress_list' %}
{% plugin_left_page ipaddress %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
{% include 'panel_table.html' with table=parent_prefixes_table heading='Parent Prefixes' %} {% include 'panel_table.html' with table=parent_prefixes_table heading='Parent Prefixes' %}
@ -166,10 +166,10 @@
{% if more_duplicate_ips %} {% if more_duplicate_ips %}
<div class="pull-right"> <div class="pull-right">
<a type="button" class="btn btn-primary btn-xs" <a type="button" class="btn btn-primary btn-xs"
{% if ipaddress.vrf %} {% if object.vrf %}
href="{% url 'ipam:ipaddress_list' %}?address={{ ipaddress.address.ip }}&vrf_id={{ ipaddress.vrf.pk }}" href="{% url 'ipam:ipaddress_list' %}?address={{ object.address.ip }}&vrf_id={{ object.vrf.pk }}"
{% else %} {% else %}
href="{% url 'ipam:ipaddress_list' %}?address={{ ipaddress.address.ip }}&vrf_id=null" href="{% url 'ipam:ipaddress_list' %}?address={{ object.address.ip }}&vrf_id=null"
{% endif %} {% endif %}
>Show all</a> >Show all</a>
</div> </div>
@ -179,12 +179,12 @@
</div> </div>
{% endif %} {% endif %}
{% include 'utilities/obj_table.html' with table=related_ips_table table_template='panel_table.html' heading='Related IP Addresses' panel_class='default noprint' %} {% include 'utilities/obj_table.html' with table=related_ips_table table_template='panel_table.html' heading='Related IP Addresses' panel_class='default noprint' %}
{% plugin_right_page ipaddress %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page ipaddress %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,10 +9,10 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:prefix_list' %}">Prefixes</a></li> <li><a href="{% url 'ipam:prefix_list' %}">Prefixes</a></li>
{% if prefix.vrf %} {% if object.vrf %}
<li><a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a></li> <li><a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a></li>
{% endif %} {% endif %}
<li>{{ prefix }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -29,49 +29,49 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons prefix %} {% plugin_buttons object %}
{% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %} {% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
<a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ prefix.vrf.pk }}&site={{ prefix.site.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success"> <a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ object.vrf.pk }}&site={{ object.site.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Child Prefix <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Child Prefix
</a> </a>
{% endif %} {% endif %}
{% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %} {% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
<a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ prefix.vrf.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success"> <a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ object.vrf.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Add an IP Address Add an IP Address
</a> </a>
{% endif %} {% endif %}
{% if perms.ipam.add_prefix %} {% if perms.ipam.add_prefix %}
{% clone_button prefix %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.ipam.change_prefix %} {% if perms.ipam.change_prefix %}
{% edit_button prefix %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.ipam.delete_prefix %} {% if perms.ipam.delete_prefix %}
{% delete_button prefix %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ prefix }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=prefix %} {% include 'inc/created_updated.html' %}
{% include 'ipam/inc/toggle_available.html' %} {% include 'ipam/inc/toggle_available.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links prefix %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs" style="margin-bottom: 20px"> <ul class="nav nav-tabs" style="margin-bottom: 20px">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{% url 'ipam:prefix' pk=prefix.pk %}">Prefix</a> <a href="{% url 'ipam:prefix' pk=object.pk %}">Prefix</a>
</li> </li>
<li role="presentation"{% if active_tab == 'prefixes' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'prefixes' %} class="active"{% endif %}>
<a href="{% url 'ipam:prefix_prefixes' pk=prefix.pk %}">Child Prefixes <span class="badge">{{ prefix.get_child_prefixes.count }}</span></a> <a href="{% url 'ipam:prefix_prefixes' pk=object.pk %}">Child Prefixes <span class="badge">{{ object.get_child_prefixes.count }}</span></a>
</li> </li>
{% if perms.ipam.view_ipaddress and prefix.status != 'container' %} {% if perms.ipam.view_ipaddress and object.status != 'container' %}
<li role="presentation"{% if active_tab == 'ip-addresses' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'ip-addresses' %} class="active"{% endif %}>
<a href="{% url 'ipam:prefix_ipaddresses' pk=prefix.pk %}">IP Addresses <span class="badge">{{ prefix.get_child_ips.count }}</span></a> <a href="{% url 'ipam:prefix_ipaddresses' pk=object.pk %}">IP Addresses <span class="badge">{{ object.get_child_ips.count }}</span></a>
</li> </li>
{% endif %} {% endif %}
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:prefix_changelog' pk=prefix.pk %}">Change Log</a> <a href="{% url 'ipam:prefix_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -87,13 +87,13 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Family</td> <td>Family</td>
<td>IPv{{ prefix.family }}</td> <td>IPv{{ object.family }}</td>
</tr> </tr>
<tr> <tr>
<td>VRF</td> <td>VRF</td>
<td> <td>
{% if prefix.vrf %} {% if object.vrf %}
<a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a> ({{ prefix.vrf.rd }}) <a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a> ({{ object.vrf.rd }})
{% else %} {% else %}
<span>Global</span> <span>Global</span>
{% endif %} {% endif %}
@ -102,11 +102,11 @@
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if prefix.tenant %} {% if object.tenant %}
{% if prefix.tenant.group %} {% if object.tenant.group %}
<a href="{{ prefix.tenant.group.get_absolute_url }}">{{ prefix.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ prefix.tenant.get_absolute_url }}">{{ prefix.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -125,11 +125,11 @@
<tr> <tr>
<td>Site</td> <td>Site</td>
<td> <td>
{% if prefix.site %} {% if object.site %}
{% if prefix.site.region %} {% if object.site.region %}
<a href="{{ prefix.site.region.get_absolute_url }}">{{ prefix.site.region }}</a> / <a href="{{ object.site.region.get_absolute_url }}">{{ object.site.region }}</a> /
{% endif %} {% endif %}
<a href="{% url 'dcim:site' slug=prefix.site.slug %}">{{ prefix.site }}</a> <a href="{% url 'dcim:site' slug=object.site.slug %}">{{ object.site }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -138,11 +138,11 @@
<tr> <tr>
<td>VLAN</td> <td>VLAN</td>
<td> <td>
{% if prefix.vlan %} {% if object.vlan %}
{% if prefix.vlan.group %} {% if object.vlan.group %}
<a href="{{ prefix.vlan.group.get_absolute_url }}">{{ prefix.vlan.group }}</a> / <a href="{{ object.vlan.group.get_absolute_url }}">{{ object.vlan.group }}</a> /
{% endif %} {% endif %}
<a href="{% url 'ipam:vlan' pk=prefix.vlan.pk %}">{{ prefix.vlan.display_name }}</a> <a href="{% url 'ipam:vlan' pk=object.vlan.pk %}">{{ object.vlan.display_name }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -151,14 +151,14 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ prefix.get_status_class }}">{{ prefix.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Role</td> <td>Role</td>
<td> <td>
{% if prefix.role %} {% if object.role %}
<a href="{% url 'ipam:prefix_list' %}?role={{ prefix.role.slug }}">{{ prefix.role }}</a> <a href="{% url 'ipam:prefix_list' %}?role={{ object.role.slug }}">{{ object.role }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -166,12 +166,12 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ prefix.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Is a pool</td> <td>Is a pool</td>
<td> <td>
{% if prefix.is_pool %} {% if object.is_pool %}
<i class="mdi mdi-check-bold text-success" title="Yes"></i> <i class="mdi mdi-check-bold text-success" title="Yes"></i>
{% else %} {% else %}
<i class="mdi mdi-close-thick text-danger" title="No"></i> <i class="mdi mdi-close-thick text-danger" title="No"></i>
@ -180,25 +180,25 @@
</tr> </tr>
<tr> <tr>
<td>Utilization</td> <td>Utilization</td>
<td>{% utilization_graph prefix.get_utilization %}</td> <td>{% utilization_graph object.get_utilization %}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=prefix %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=prefix.tags.all url='ipam:prefix_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:prefix_list' %}
{% plugin_left_page prefix %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-7"> <div class="col-md-7">
{% if duplicate_prefix_table.rows %} {% if duplicate_prefix_table.rows %}
{% include 'panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' panel_class='danger' %} {% include 'panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' panel_class='danger' %}
{% endif %} {% endif %}
{% include 'panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' panel_class='default' %} {% include 'panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' panel_class='default' %}
{% plugin_right_page prefix %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page prefix %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,7 +9,7 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:routetarget_list' %}">Route Targets</a></li> <li><a href="{% url 'ipam:routetarget_list' %}">Route Targets</a></li>
<li>{{ routetarget }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -26,29 +26,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons routetarget %} {% plugin_buttons object %}
{% if perms.ipam.add_routetarget %} {% if perms.ipam.add_routetarget %}
{% clone_button routetarget %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.ipam.change_routetarget %} {% if perms.ipam.change_routetarget %}
{% edit_button routetarget %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.ipam.delete_routetarget %} {% if perms.ipam.delete_routetarget %}
{% delete_button routetarget %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}Route target {{ routetarget }}{% endblock %}</h1> <h1>{% block title %}Route target {{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=routetarget %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links routetarget %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ routetarget.get_absolute_url }}">Route Target</a> <a href="{{ object.get_absolute_url }}">Route Target</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:routetarget_changelog' pk=routetarget.pk %}">Change Log</a> <a href="{% url 'ipam:routetarget_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -64,13 +64,13 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ routetarget.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if routetarget.tenant %} {% if object.tenant %}
<a href="{{ routetarget.tenant.get_absolute_url }}">{{ routetarget.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -82,19 +82,19 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=routetarget.tags.all url='ipam:routetarget_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:routetarget_list' %}
{% include 'inc/custom_fields_panel.html' with obj=routetarget %} {% include 'inc/custom_fields_panel.html' %}
{% plugin_left_page routetarget %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'panel_table.html' with table=importing_vrfs_table heading="Importing VRFs" %} {% include 'panel_table.html' with table=importing_vrfs_table heading="Importing VRFs" %}
{% include 'panel_table.html' with table=exporting_vrfs_table heading="Exporting VRFs" %} {% include 'panel_table.html' with table=exporting_vrfs_table heading="Exporting VRFs" %}
{% plugin_right_page routetarget %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page routetarget %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,8 +9,8 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:service_list' %}">Services</a></li> <li><a href="{% url 'ipam:service_list' %}">Services</a></li>
<li><a href="{{ service.parent.get_absolute_url }}">{{ service.parent }}</a></li> <li><a href="{{ object.parent.get_absolute_url }}">{{ object.parent }}</a></li>
<li>{{ service }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -27,18 +27,18 @@
</div> </div>
</div> </div>
<div class="pull-right"> <div class="pull-right">
{% plugin_buttons service %} {% plugin_buttons object %}
{% if perms.dcim.change_service %} {% if perms.dcim.change_service %}
{% edit_button service %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.dcim.delete_service %} {% if perms.dcim.delete_service %}
{% delete_button service %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ service }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=service %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links service %} {% custom_links object %}
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
@ -49,26 +49,26 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ service.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Parent</td> <td>Parent</td>
<td> <td>
<a href="{{ service.parent.get_absolute_url }}">{{ service.parent }}</a> <a href="{{ object.parent.get_absolute_url }}">{{ object.parent }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Protocol</td> <td>Protocol</td>
<td>{{ service.get_protocol_display }}</td> <td>{{ object.get_protocol_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Ports</td> <td>Ports</td>
<td>{{ service.port_list }}</td> <td>{{ object.port_list }}</td>
</tr> </tr>
<tr> <tr>
<td>IP Addresses</td> <td>IP Addresses</td>
<td> <td>
{% for ipaddress in service.ipaddresses.all %} {% for ipaddress in object.ipaddresses.all %}
<a href="{{ ipaddress.get_absolute_url }}">{{ ipaddress }}</a><br /> <a href="{{ ipaddress.get_absolute_url }}">{{ ipaddress }}</a><br />
{% empty %} {% empty %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
@ -77,21 +77,21 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ service.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=service %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=service.tags.all url='ipam:service_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:service_list' %}
{% plugin_left_page service %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% plugin_right_page service %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page service %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,13 +9,13 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:vlan_list' %}">VLANs</a></li> <li><a href="{% url 'ipam:vlan_list' %}">VLANs</a></li>
{% if vlan.site %} {% if object.site %}
<li><a href="{% url 'ipam:vlan_list' %}?site={{ vlan.site.slug }}">{{ vlan.site }}</a></li> <li><a href="{% url 'ipam:vlan_list' %}?site={{ object.site.slug }}">{{ object.site }}</a></li>
{% endif %} {% endif %}
{% if vlan.group %} {% if object.group %}
<li><a href="{% url 'ipam:vlan_list' %}?group={{ vlan.group.slug }}">{{ vlan.group }}</a></li> <li><a href="{% url 'ipam:vlan_list' %}?group={{ object.group.slug }}">{{ object.group }}</a></li>
{% endif %} {% endif %}
<li>{{ vlan }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -32,35 +32,35 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons vlan %} {% plugin_buttons object %}
{% if perms.ipam.add_vlan %} {% if perms.ipam.add_vlan %}
{% clone_button vlan %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.ipam.change_vlan %} {% if perms.ipam.change_vlan %}
{% edit_button vlan %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.ipam.delete_vlan %} {% if perms.ipam.delete_vlan %}
{% delete_button vlan %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}VLAN {{ vlan.display_name }}{% endblock %}</h1> <h1>{% block title %}VLAN {{ object.display_name }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=vlan %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links vlan %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs" style="margin-bottom: 20px"> <ul class="nav nav-tabs" style="margin-bottom: 20px">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{% url 'ipam:vlan' pk=vlan.pk %}">VLAN</a> <a href="{% url 'ipam:vlan' pk=object.pk %}">VLAN</a>
</li> </li>
<li role="presentation"{% if active_tab == 'interfaces' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'interfaces' %} class="active"{% endif %}>
<a href="{% url 'ipam:vlan_interfaces' pk=vlan.pk %}">Device Interfaces <span class="badge">{{ vlan.get_interfaces.count }}</span></a> <a href="{% url 'ipam:vlan_interfaces' pk=object.pk %}">Device Interfaces <span class="badge">{{ object.get_interfaces.count }}</span></a>
</li> </li>
<li role="presentation"{% if active_tab == 'vminterfaces' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'vminterfaces' %} class="active"{% endif %}>
<a href="{% url 'ipam:vlan_vminterfaces' pk=vlan.pk %}">VM Interfaces <span class="badge">{{ vlan.get_vminterfaces.count }}</span></a> <a href="{% url 'ipam:vlan_vminterfaces' pk=object.pk %}">VM Interfaces <span class="badge">{{ object.get_vminterfaces.count }}</span></a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:vlan_changelog' pk=vlan.pk %}">Change Log</a> <a href="{% url 'ipam:vlan_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -77,11 +77,11 @@
<tr> <tr>
<td>Site</td> <td>Site</td>
<td> <td>
{% if vlan.site %} {% if object.site %}
{% if vlan.site.region %} {% if object.site.region %}
<a href="{{ vlan.site.region.get_absolute_url }}">{{ vlan.site.region }}</a> / <a href="{{ object.site.region.get_absolute_url }}">{{ object.site.region }}</a> /
{% endif %} {% endif %}
<a href="{% url 'dcim:site' slug=vlan.site.slug %}">{{ vlan.site }}</a> <a href="{% url 'dcim:site' slug=object.site.slug %}">{{ object.site }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -90,8 +90,8 @@
<tr> <tr>
<td>Group</td> <td>Group</td>
<td> <td>
{% if vlan.group %} {% if object.group %}
<a href="{{ vlan.group.get_absolute_url }}">{{ vlan.group }}</a> <a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -99,20 +99,20 @@
</tr> </tr>
<tr> <tr>
<td>VLAN ID</td> <td>VLAN ID</td>
<td>{{ vlan.vid }}</td> <td>{{ object.vid }}</td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ vlan.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if vlan.tenant %} {% if object.tenant %}
{% if vlan.tenant.group %} {% if object.tenant.group %}
<a href="{{ vlan.tenant.group.get_absolute_url }}">{{ vlan.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ vlan.tenant.get_absolute_url }}">{{ vlan.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -121,14 +121,14 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ vlan.get_status_class }}">{{ vlan.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Role</td> <td>Role</td>
<td> <td>
{% if vlan.role %} {% if object.role %}
<a href="{% url 'ipam:vlan_list' %}?role={{ vlan.role.slug }}">{{ vlan.role }}</a> <a href="{% url 'ipam:vlan_list' %}?role={{ object.role.slug }}">{{ object.role }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -136,13 +136,13 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ vlan.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=vlan %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=vlan.tags.all url='ipam:vlan_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:vlan_list' %}
{% plugin_left_page vlan %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<div class="panel panel-default"> <div class="panel panel-default">
@ -152,19 +152,19 @@
{% include 'responsive_table.html' with table=prefix_table %} {% include 'responsive_table.html' with table=prefix_table %}
{% if perms.ipam.add_prefix %} {% if perms.ipam.add_prefix %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'ipam:prefix_add' %}?{% if vlan.tenant %}tenant={{ vlan.tenant.pk }}&{% endif %}site={{ vlan.site.pk }}&vlan={{ vlan.pk }}" class="btn btn-primary btn-xs"> <a href="{% url 'ipam:prefix_add' %}?{% if object.tenant %}tenant={{ object.tenant.pk }}&{% endif %}site={{ object.site.pk }}&vlan={{ object.pk }}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Add a prefix Add a prefix
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page vlan %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page vlan %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,16 +1,16 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}{{ vlan_group }} - VLANs{% endblock %} {% block title %}{{ object }} - VLANs{% endblock %}
{% block content %} {% block content %}
<div class="row noprint"> <div class="row noprint">
<div class="col-sm-12 col-md-12"> <div class="col-sm-12 col-md-12">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:vlangroup_list' %}">VLAN Groups</a></li> <li><a href="{% url 'ipam:vlangroup_list' %}">VLAN Groups</a></li>
{% if vlan_group.site %} {% if object.site %}
<li><a href="{% url 'dcim:site' slug=vlan_group.site.slug %}">{{ vlan_group.site }}</a></li> <li><a href="{% url 'dcim:site' slug=object.site.slug %}">{{ object.site }}</a></li>
{% endif %} {% endif %}
<li>{{ vlan_group }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
</div> </div>

View File

@ -9,7 +9,7 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'ipam:vrf_list' %}">VRFs</a></li> <li><a href="{% url 'ipam:vrf_list' %}">VRFs</a></li>
<li>{{ vrf }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -26,29 +26,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons vrf %} {% plugin_buttons object %}
{% if perms.ipam.add_vrf %} {% if perms.ipam.add_vrf %}
{% clone_button vrf %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.ipam.change_vrf %} {% if perms.ipam.change_vrf %}
{% edit_button vrf %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.ipam.delete_vrf %} {% if perms.ipam.delete_vrf %}
{% delete_button vrf %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}VRF {{ vrf }}{% endblock %}</h1> <h1>{% block title %}VRF {{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=vrf %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links vrf %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ vrf.get_absolute_url }}">VRF</a> <a href="{{ object.get_absolute_url }}">VRF</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:vrf_changelog' pk=vrf.pk %}">Change Log</a> <a href="{% url 'ipam:vrf_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -64,13 +64,13 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Route Distinguisher</td> <td>Route Distinguisher</td>
<td>{{ vrf.rd }}</td> <td>{{ object.rd }}</td>
</tr> </tr>
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if vrf.tenant %} {% if object.tenant %}
<a href="{{ vrf.tenant.get_absolute_url }}">{{ vrf.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -79,7 +79,7 @@
<tr> <tr>
<td>Unique IP Space</td> <td>Unique IP Space</td>
<td> <td>
{% if vrf.enforce_unique %} {% if object.enforce_unique %}
<i class="mdi mdi-check-bold text-success" title="Yes"></i> <i class="mdi mdi-check-bold text-success" title="Yes"></i>
{% else %} {% else %}
<i class="mdi mdi-close-thick text-danger" title="No"></i> <i class="mdi mdi-close-thick text-danger" title="No"></i>
@ -88,29 +88,29 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ vrf.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Prefixes</td> <td>Prefixes</td>
<td> <td>
<a href="{% url 'ipam:prefix_list' %}?vrf_id={{ vrf.pk }}">{{ prefix_count }}</a> <a href="{% url 'ipam:prefix_list' %}?vrf_id={{ object.pk }}">{{ prefix_count }}</a>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=vrf.tags.all url='ipam:vrf_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:vrf_list' %}
{% include 'inc/custom_fields_panel.html' with obj=vrf %} {% include 'inc/custom_fields_panel.html' %}
{% plugin_left_page vrf %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'panel_table.html' with table=import_targets_table heading="Import Route Targets" %} {% include 'panel_table.html' with table=import_targets_table heading="Import Route Targets" %}
{% include 'panel_table.html' with table=export_targets_table heading="Export Route Targets" %} {% include 'panel_table.html' with table=export_targets_table heading="Export Route Targets" %}
{% plugin_right_page vrf %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page vrf %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -10,33 +10,33 @@
<div class="col-md-12"> <div class="col-md-12">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'secrets:secret_list' %}">Secrets</a></li> <li><a href="{% url 'secrets:secret_list' %}">Secrets</a></li>
<li><a href="{% url 'secrets:secret_list' %}?role={{ secret.role.slug }}">{{ secret.role }}</a></li> <li><a href="{% url 'secrets:secret_list' %}?role={{ object.role.slug }}">{{ object.role }}</a></li>
<li><a href="{{ secret.assigned_object.get_absolute_url }}">{{ secret.assigned_object }}</a></li> <li><a href="{{ object.assigned_object.get_absolute_url }}">{{ object.assigned_object }}</a></li>
<li>{{ secret }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons secret %} {% plugin_buttons object %}
{% if perms.secrets.change_secret %} {% if perms.secrets.change_secret %}
{% edit_button secret %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.secrets.delete_secret %} {% if perms.secrets.delete_secret %}
{% delete_button secret %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ secret }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=secret %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links secret %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ secret.get_absolute_url }}">Secret</a> <a href="{{ object.get_absolute_url }}">Secret</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'secrets:secret_changelog' pk=secret.pk %}">Change Log</a> <a href="{% url 'secrets:secret_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -53,21 +53,21 @@
<tr> <tr>
<td>Assigned object</td> <td>Assigned object</td>
<td> <td>
<a href="{{ secret.assigned_object.get_absolute_url }}">{{ secret.assigned_object }}</a> <a href="{{ object.assigned_object.get_absolute_url }}">{{ object.assigned_object }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Role</td> <td>Role</td>
<td>{{ secret.role }}</td> <td>{{ object.role }}</td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ secret.name|placeholder }}</td> <td>{{ object.name|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=secret %} {% include 'inc/custom_fields_panel.html' %}
{% plugin_left_page secret %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -80,28 +80,28 @@
</form> </form>
<div class="row"> <div class="row">
<div class="col-md-2">Secret</div> <div class="col-md-2">Secret</div>
<div class="col-md-6" id="secret_{{ secret.pk }}">********</div> <div class="col-md-6" id="secret_{{ object.pk }}">********</div>
<div class="col-md-4 text-right noprint"> <div class="col-md-4 text-right noprint">
<button class="btn btn-xs btn-success unlock-secret" secret-id="{{ secret.pk }}"> <button class="btn btn-xs btn-success unlock-secret" secret-id="{{ object.pk }}">
<i class="mdi mdi-lock"></i> Unlock <i class="mdi mdi-lock"></i> Unlock
</button> </button>
<button class="btn btn-xs btn-default copy-secret collapse" secret-id="{{ secret.pk }}" data-clipboard-target="#secret_{{ secret.pk }}"> <button class="btn btn-xs btn-default copy-secret collapse" secret-id="{{ object.pk }}" data-clipboard-target="#secret_{{ object.pk }}">
<i class="mdi mdi-content-copy"></i> Copy <i class="mdi mdi-content-copy"></i> Copy
</button> </button>
<button class="btn btn-xs btn-danger lock-secret collapse" secret-id="{{ secret.pk }}"> <button class="btn btn-xs btn-danger lock-secret collapse" secret-id="{{ object.pk }}">
<i class="mdi mdi-lock-open"></i> Lock <i class="mdi mdi-lock-open"></i> Lock
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=secret.tags.all url='secrets:secret_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='secrets:secret_list' %}
{% plugin_right_page secret %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page secret %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>

View File

@ -9,10 +9,10 @@
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'tenancy:tenant_list' %}">Tenants</a></li> <li><a href="{% url 'tenancy:tenant_list' %}">Tenants</a></li>
{% if tenant.group %} {% if object.group %}
<li><a href="{% url 'tenancy:tenant_list' %}?group={{ tenant.group.slug }}">{{ tenant.group }}</a></li> <li><a href="{% url 'tenancy:tenant_list' %}?group={{ object.group.slug }}">{{ object.group }}</a></li>
{% endif %} {% endif %}
<li>{{ tenant }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -29,29 +29,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons tenant %} {% plugin_buttons object %}
{% if perms.tenancy.add_tenant %} {% if perms.tenancy.add_tenant %}
{% clone_button tenant %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.tenancy.change_tenant %} {% if perms.tenancy.change_tenant %}
{% edit_button tenant %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.tenancy.delete_tenant %} {% if perms.tenancy.delete_tenant %}
{% delete_button tenant %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ tenant }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=tenant %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links tenant %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ tenant.get_absolute_url }}">Tenant</a> <a href="{{ object.get_absolute_url }}">Tenant</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'tenancy:tenant_changelog' slug=tenant.slug %}">Change Log</a> <a href="{% url 'tenancy:tenant_changelog' slug=object.slug %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -68,8 +68,8 @@
<tr> <tr>
<td>Group</td> <td>Group</td>
<td> <td>
{% if tenant.group %} {% if object.group %}
<a href="{{ tenant.group.get_absolute_url }}">{{ tenant.group }}</a> <a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -77,25 +77,25 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ tenant.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=tenant %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=tenant.tags.all url='tenancy:tenant_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='tenancy:tenant_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if tenant.comments %} {% if object.comments %}
{{ tenant.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_left_page tenant %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<div class="panel panel-default"> <div class="panel panel-default">
@ -104,57 +104,57 @@
</div> </div>
<div class="row panel-body"> <div class="row panel-body">
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'dcim:site_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.site_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.site_count }}</a></h2> <h2><a href="{% url 'dcim:site_list' %}?tenant={{ object.slug }}" class="btn {% if stats.site_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.site_count }}</a></h2>
<p>Sites</p> <p>Sites</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'dcim:rack_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.rack_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.rack_count }}</a></h2> <h2><a href="{% url 'dcim:rack_list' %}?tenant={{ object.slug }}" class="btn {% if stats.rack_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.rack_count }}</a></h2>
<p>Racks</p> <p>Racks</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'dcim:rackreservation_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.rackreservation_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.rackreservation_count }}</a></h2> <h2><a href="{% url 'dcim:rackreservation_list' %}?tenant={{ object.slug }}" class="btn {% if stats.rackreservation_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.rackreservation_count }}</a></h2>
<p>Rack reservations</p> <p>Rack reservations</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'dcim:device_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.device_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.device_count }}</a></h2> <h2><a href="{% url 'dcim:device_list' %}?tenant={{ object.slug }}" class="btn {% if stats.device_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.device_count }}</a></h2>
<p>Devices</p> <p>Devices</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'ipam:vrf_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.vrf_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vrf_count }}</a></h2> <h2><a href="{% url 'ipam:vrf_list' %}?tenant={{ object.slug }}" class="btn {% if stats.vrf_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vrf_count }}</a></h2>
<p>VRFs</p> <p>VRFs</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'ipam:prefix_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.prefix_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2> <h2><a href="{% url 'ipam:prefix_list' %}?tenant={{ object.slug }}" class="btn {% if stats.prefix_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2>
<p>Prefixes</p> <p>Prefixes</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'ipam:ipaddress_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.ipaddress_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.ipaddress_count }}</a></h2> <h2><a href="{% url 'ipam:ipaddress_list' %}?tenant={{ object.slug }}" class="btn {% if stats.ipaddress_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.ipaddress_count }}</a></h2>
<p>IP addresses</p> <p>IP addresses</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'ipam:vlan_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.vlan_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vlan_count }}</a></h2> <h2><a href="{% url 'ipam:vlan_list' %}?tenant={{ object.slug }}" class="btn {% if stats.vlan_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vlan_count }}</a></h2>
<p>VLANs</p> <p>VLANs</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'circuits:circuit_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.circuit_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.circuit_count }}</a></h2> <h2><a href="{% url 'circuits:circuit_list' %}?tenant={{ object.slug }}" class="btn {% if stats.circuit_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.circuit_count }}</a></h2>
<p>Circuits</p> <p>Circuits</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'virtualization:virtualmachine_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.virtualmachine_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.virtualmachine_count }}</a></h2> <h2><a href="{% url 'virtualization:virtualmachine_list' %}?tenant={{ object.slug }}" class="btn {% if stats.virtualmachine_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.virtualmachine_count }}</a></h2>
<p>Virtual machines</p> <p>Virtual machines</p>
</div> </div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<h2><a href="{% url 'virtualization:cluster_list' %}?tenant={{ tenant.slug }}" class="btn {% if stats.cluster_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.cluster_count }}</a></h2> <h2><a href="{% url 'virtualization:cluster_list' %}?tenant={{ object.slug }}" class="btn {% if stats.cluster_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.cluster_count }}</a></h2>
<p>Clusters</p> <p>Clusters</p>
</div> </div>
</div> </div>
</div> </div>
{% plugin_right_page tenant %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page tenant %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -3,7 +3,7 @@
{% block title %}User Key{% endblock %} {% block title %}User Key{% endblock %}
{% block usercontent %} {% block usercontent %}
{% if userkey %} {% if object %}
<div class="pull-right noprint"> <div class="pull-right noprint">
<a href="{% url 'user:userkey_edit' %}" class="btn btn-warning"> <a href="{% url 'user:userkey_edit' %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> <span class="mdi mdi-pencil" aria-hidden="true"></span>
@ -12,22 +12,22 @@
</div> </div>
<h4> <h4>
Your user key is: Your user key is:
{% if userkey.is_active %} {% if object.is_active %}
<span class="label label-success">Active</span> <span class="label label-success">Active</span>
{% else %} {% else %}
<span class="label label-danger">Inactive</span> <span class="label label-danger">Inactive</span>
{% endif %} {% endif %}
</h4> </h4>
{% include 'inc/created_updated.html' with obj=userkey %} {% include 'inc/created_updated.html' %}
{% if not userkey.is_active %} {% if not object.is_active %}
<div class="alert alert-warning" role="alert"> <div class="alert alert-warning" role="alert">
<i class="mdi mdi-alert"></i> <i class="mdi mdi-alert"></i>
Your user key is inactive. Ask an administrator to enable it for you. Your user key is inactive. Ask an administrator to enable it for you.
</div> </div>
{% endif %} {% endif %}
<pre>{{ userkey.public_key }}</pre> <pre>{{ object.public_key }}</pre>
<hr /> <hr />
{% if userkey.session_key %} {% if object.session_key %}
<div class="pull-right noprint"> <div class="pull-right noprint">
<a href="{% url 'user:sessionkey_delete' %}" class="btn btn-danger"> <a href="{% url 'user:sessionkey_delete' %}" class="btn btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span>
@ -35,7 +35,7 @@
</a> </a>
</div> </div>
<h4>Session key: <span class="label label-success">Active</span></h4> <h4>Session key: <span class="label label-success">Active</span></h4>
<small class="text-muted">Created {{ userkey.session_key.created }}</small> <small class="text-muted">Created {{ object.session_key.created }}</small>
{% else %} {% else %}
<h4>No active session key</h4> <h4>No active session key</h4>
{% endif %} {% endif %}

View File

@ -5,7 +5,7 @@
{% block title %}User Key{% endblock %} {% block title %}User Key{% endblock %}
{% block usercontent %} {% block usercontent %}
{% if userkey.is_active %} {% if object.is_active %}
<div class="alert alert-danger" role="alert"> <div class="alert alert-danger" role="alert">
<strong>Warning:</strong> Changing your public key will require your user key to be re-activated by another <strong>Warning:</strong> Changing your public key will require your user key to be re-activated by another
user. You will be unable to retrieve any secrets until your key has been reactivated. user. You will be unable to retrieve any secrets until your key has been reactivated.

View File

@ -8,11 +8,11 @@
<div class="row noprint" xmlns="http://www.w3.org/1999/html"> <div class="row noprint" xmlns="http://www.w3.org/1999/html">
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{{ cluster.type.get_absolute_url }}">{{ cluster.type }}</a></li> <li><a href="{{ object.type.get_absolute_url }}">{{ object.type }}</a></li>
{% if cluster.group %} {% if object.group %}
<li><a href="{{ cluster.group.get_absolute_url }}">{{ cluster.group }}</a></li> <li><a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a></li>
{% endif %} {% endif %}
<li>{{ cluster }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -29,29 +29,29 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons cluster %} {% plugin_buttons object %}
{% if perms.virtualization.add_cluster %} {% if perms.virtualization.add_cluster %}
{% clone_button cluster %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.virtualization.change_cluster %} {% if perms.virtualization.change_cluster %}
{% edit_button cluster %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.virtualization.delete_cluster %} {% if perms.virtualization.delete_cluster %}
{% delete_button cluster %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ cluster }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=cluster %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links cluster %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ cluster.get_absolute_url }}">Cluster</a> <a href="{{ object.get_absolute_url }}">Cluster</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'virtualization:cluster_changelog' pk=cluster.pk %}">Change Log</a> <a href="{% url 'virtualization:cluster_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -67,17 +67,17 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ cluster.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td><a href="{{ cluster.type.get_absolute_url }}">{{ cluster.type }}</a></td> <td><a href="{{ object.type.get_absolute_url }}">{{ object.type }}</a></td>
</tr> </tr>
<tr> <tr>
<td>Group</td> <td>Group</td>
<td> <td>
{% if cluster.group %} {% if object.group %}
<a href="{{ cluster.group.get_absolute_url }}">{{ cluster.group }}</a> <a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -86,8 +86,8 @@
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if cluster.tenant %} {% if object.tenant %}
<a href="{{ cluster.tenant.get_absolute_url }}">{{ cluster.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -96,8 +96,8 @@
<tr> <tr>
<td>Site</td> <td>Site</td>
<td> <td>
{% if cluster.site %} {% if object.site %}
<a href="{{ cluster.site.get_absolute_url }}">{{ cluster.site }}</a> <a href="{{ object.site.get_absolute_url }}">{{ object.site }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -105,25 +105,25 @@
</tr> </tr>
<tr> <tr>
<td>Virtual Machines</td> <td>Virtual Machines</td>
<td><a href="{% url 'virtualization:virtualmachine_list' %}?cluster_id={{ cluster.pk }}">{{ cluster.virtual_machines.count }}</a></td> <td><a href="{% url 'virtualization:virtualmachine_list' %}?cluster_id={{ object.pk }}">{{ object.virtual_machines.count }}</a></td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=cluster %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=cluster.tags.all url='virtualization:cluster_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:cluster_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if cluster.comments %} {% if object.comments %}
{{ cluster.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_left_page cluster %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-7"> <div class="col-md-7">
<div class="panel panel-default"> <div class="panel panel-default">
@ -131,14 +131,14 @@
<strong>Host Devices</strong> <strong>Host Devices</strong>
</div> </div>
{% if perms.virtualization.change_cluster %} {% if perms.virtualization.change_cluster %}
<form action="{% url 'virtualization:cluster_remove_devices' pk=cluster.pk %}" method="post"> <form action="{% url 'virtualization:cluster_remove_devices' pk=object.pk %}" method="post">
{% csrf_token %} {% csrf_token %}
{% endif %} {% endif %}
{% include 'responsive_table.html' with table=device_table %} {% include 'responsive_table.html' with table=device_table %}
{% if perms.virtualization.change_cluster %} {% if perms.virtualization.change_cluster %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'virtualization:cluster_add_devices' pk=cluster.pk %}?site={{ cluster.site.pk }}" class="btn btn-primary btn-xs"> <a href="{% url 'virtualization:cluster_add_devices' pk=object.pk %}?site={{ object.site.pk }}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Add devices Add devices
</a> </a>
@ -151,12 +151,12 @@
</form> </form>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page cluster %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page cluster %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,10 +9,10 @@
<div class="row noprint"> <div class="row noprint">
<div class="col-sm-8 col-md-9"> <div class="col-sm-8 col-md-9">
<ol class="breadcrumb"> <ol class="breadcrumb">
{% if virtualmachine.cluster %} {% if object.cluster %}
<li><a href="{{ virtualmachine.cluster.get_absolute_url }}">{{ virtualmachine.cluster }}</a></li> <li><a href="{{ object.cluster.get_absolute_url }}">{{ object.cluster }}</a></li>
{% endif %} {% endif %}
<li>{{ virtualmachine }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
<div class="col-sm-4 col-md-3"> <div class="col-sm-4 col-md-3">
@ -30,38 +30,38 @@
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% if perms.virtualization.add_vminterface %} {% if perms.virtualization.add_vminterface %}
<a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ virtualmachine.pk }}&return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-primary"> <a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Interfaces <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Interfaces
</a> </a>
{% endif %} {% endif %}
{% plugin_buttons virtualmachine %} {% plugin_buttons object %}
{% if perms.virtualization.add_virtualmachine %} {% if perms.virtualization.add_virtualmachine %}
{% clone_button virtualmachine %} {% clone_button object %}
{% endif %} {% endif %}
{% if perms.virtualization.change_virtualmachine %} {% if perms.virtualization.change_virtualmachine %}
{% edit_button virtualmachine %} {% edit_button object %}
{% endif %} {% endif %}
{% if perms.virtualization.delete_virtualmachine %} {% if perms.virtualization.delete_virtualmachine %}
{% delete_button virtualmachine %} {% delete_button object %}
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ virtualmachine }}{% endblock %}</h1> <h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=virtualmachine %} {% include 'inc/created_updated.html' %}
<div class="pull-right noprint"> <div class="pull-right noprint">
{% custom_links virtualmachine %} {% custom_links object %}
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ virtualmachine.get_absolute_url }}">Virtual Machine</a> <a href="{{ object.get_absolute_url }}">Virtual Machine</a>
</li> </li>
{% if perms.extras.view_configcontext %} {% if perms.extras.view_configcontext %}
<li role="presentation"{% if active_tab == 'config-context' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'config-context' %} class="active"{% endif %}>
<a href="{% url 'virtualization:virtualmachine_configcontext' pk=virtualmachine.pk %}">Config Context</a> <a href="{% url 'virtualization:virtualmachine_configcontext' pk=object.pk %}">Config Context</a>
</li> </li>
{% endif %} {% endif %}
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'virtualization:virtualmachine_changelog' pk=virtualmachine.pk %}">Change Log</a> <a href="{% url 'virtualization:virtualmachine_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -77,19 +77,19 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ virtualmachine }}</td> <td>{{ object }}</td>
</tr> </tr>
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<span class="label label-{{ virtualmachine.get_status_class }}">{{ virtualmachine.get_status_display }}</span> <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Role</td> <td>Role</td>
<td> <td>
{% if virtualmachine.role %} {% if object.role %}
<a href="{% url 'virtualization:virtualmachine_list' %}?role={{ virtualmachine.role.slug }}">{{ virtualmachine.role }}</a> <a href="{% url 'virtualization:virtualmachine_list' %}?role={{ object.role.slug }}">{{ object.role }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -98,8 +98,8 @@
<tr> <tr>
<td>Platform</td> <td>Platform</td>
<td> <td>
{% if virtualmachine.platform %} {% if object.platform %}
<a href="{% url 'virtualization:virtualmachine_list' %}?platform={{ virtualmachine.platform.slug }}">{{ virtualmachine.platform }}</a> <a href="{% url 'virtualization:virtualmachine_list' %}?platform={{ object.platform.slug }}">{{ object.platform }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -108,11 +108,11 @@
<tr> <tr>
<td>Tenant</td> <td>Tenant</td>
<td> <td>
{% if virtualmachine.tenant %} {% if object.tenant %}
{% if virtualmachine.tenant.group %} {% if object.tenant.group %}
<a href="{{ virtualmachine.tenant.group.get_absolute_url }}">{{ virtualmachine.tenant.group }}</a> / <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
{% endif %} {% endif %}
<a href="{{ virtualmachine.tenant.get_absolute_url }}">{{ virtualmachine.tenant }}</a> <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
@ -121,12 +121,12 @@
<tr> <tr>
<td>Primary IPv4</td> <td>Primary IPv4</td>
<td> <td>
{% if virtualmachine.primary_ip4 %} {% if object.primary_ip4 %}
<a href="{% url 'ipam:ipaddress' pk=virtualmachine.primary_ip4.pk %}">{{ virtualmachine.primary_ip4.address.ip }}</a> <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a>
{% if virtualmachine.primary_ip4.nat_inside %} {% if object.primary_ip4.nat_inside %}
<span>(NAT for {{ virtualmachine.primary_ip4.nat_inside.address.ip }})</span> <span>(NAT for {{ object.primary_ip4.nat_inside.address.ip }})</span>
{% elif virtualmachine.primary_ip4.nat_outside %} {% elif object.primary_ip4.nat_outside %}
<span>(NAT: {{ virtualmachine.primary_ip4.nat_outside.address.ip }})</span> <span>(NAT: {{ object.primary_ip4.nat_outside.address.ip }})</span>
{% endif %} {% endif %}
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
@ -136,12 +136,12 @@
<tr> <tr>
<td>Primary IPv6</td> <td>Primary IPv6</td>
<td> <td>
{% if virtualmachine.primary_ip6 %} {% if object.primary_ip6 %}
<a href="{% url 'ipam:ipaddress' pk=virtualmachine.primary_ip6.pk %}">{{ virtualmachine.primary_ip6.address.ip }}</a> <a href="{% url 'ipam:ipaddress' pk=object.primary_ip6.pk %}">{{ object.primary_ip6.address.ip }}</a>
{% if virtualmachine.primary_ip6.nat_inside %} {% if object.primary_ip6.nat_inside %}
<span>(NAT for {{ virtualmachine.primary_ip6.nat_inside.address.ip }})</span> <span>(NAT for {{ object.primary_ip6.nat_inside.address.ip }})</span>
{% elif virtualmachine.primary_ip6.nat_outside %} {% elif object.primary_ip6.nat_outside %}
<span>(NAT: {{ virtualmachine.primary_ip6.nat_outside.address.ip }})</span> <span>(NAT: {{ object.primary_ip6.nat_outside.address.ip }})</span>
{% endif %} {% endif %}
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
@ -150,21 +150,21 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/custom_fields_panel.html' with obj=virtualmachine %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=virtualmachine.tags.all url='virtualization:virtualmachine_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:virtualmachine_list' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Comments</strong> <strong>Comments</strong>
</div> </div>
<div class="panel-body rendered-markdown"> <div class="panel-body rendered-markdown">
{% if virtualmachine.comments %} {% if object.comments %}
{{ virtualmachine.comments|render_markdown }} {{ object.comments|render_markdown }}
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% plugin_left_page virtualmachine %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -175,15 +175,15 @@
<tr> <tr>
<td>Cluster</td> <td>Cluster</td>
<td> <td>
{% if virtualmachine.cluster.group %} {% if object.cluster.group %}
<a href="{{ virtualmachine.cluster.group.get_absolute_url }}">{{ virtualmachine.cluster.group }}</a> / <a href="{{ object.cluster.group.get_absolute_url }}">{{ object.cluster.group }}</a> /
{% endif %} {% endif %}
<a href="{{ virtualmachine.cluster.get_absolute_url }}">{{ virtualmachine.cluster }}</a> <a href="{{ object.cluster.get_absolute_url }}">{{ object.cluster }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Cluster Type</td> <td>Cluster Type</td>
<td>{{ virtualmachine.cluster.type }}</td> <td>{{ object.cluster.type }}</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -194,13 +194,13 @@
<table class="table table-hover panel-body attr-table"> <table class="table table-hover panel-body attr-table">
<tr> <tr>
<td><i class="mdi mdi-gauge"></i> Virtual CPUs</td> <td><i class="mdi mdi-gauge"></i> Virtual CPUs</td>
<td>{{ virtualmachine.vcpus|placeholder }}</td> <td>{{ object.vcpus|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td><i class="mdi mdi-chip"></i> Memory</td> <td><i class="mdi mdi-chip"></i> Memory</td>
<td> <td>
{% if virtualmachine.memory %} {% if object.memory %}
{{ virtualmachine.memory }} MB {{ object.memory }} MB
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -209,8 +209,8 @@
<tr> <tr>
<td><i class="mdi mdi-harddisk"></i> Disk Space</td> <td><i class="mdi mdi-harddisk"></i> Disk Space</td>
<td> <td>
{% if virtualmachine.disk %} {% if object.disk %}
{{ virtualmachine.disk }} GB {{ object.disk }} GB
{% else %} {% else %}
<span class="text-muted">&mdash;</span> <span class="text-muted">&mdash;</span>
{% endif %} {% endif %}
@ -226,7 +226,7 @@
{% include 'secrets/inc/assigned_secrets.html' %} {% include 'secrets/inc/assigned_secrets.html' %}
{% if perms.secrets.add_secret %} {% if perms.secrets.add_secret %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'secrets:secret_add' %}?virtual_machine={{ virtualmachine.pk }}&return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-xs btn-primary"> <a href="{% url 'secrets:secret_add' %}?virtual_machine={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add secret <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add secret
</a> </a>
</div> </div>
@ -250,25 +250,25 @@
{% endif %} {% endif %}
{% if perms.ipam.add_service %} {% if perms.ipam.add_service %}
<div class="panel-footer text-right noprint"> <div class="panel-footer text-right noprint">
<a href="{% url 'virtualization:virtualmachine_service_assign' virtualmachine=virtualmachine.pk %}" class="btn btn-xs btn-primary"> <a href="{% url 'virtualization:virtualmachine_service_assign' virtualmachine=object.pk %}" class="btn btn-xs btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Assign service <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Assign service
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page virtualmachine %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page virtualmachine %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="virtual_machine" value="{{ virtualmachine.pk }}" /> <input type="hidden" name="virtual_machine" value="{{ object.pk }}" />
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Interfaces</strong> <strong>Interfaces</strong>
@ -285,21 +285,21 @@
{% if perms.virtualization.add_vminterface or perms.virtualization.delete_vminterface %} {% if perms.virtualization.add_vminterface or perms.virtualization.delete_vminterface %}
<div class="panel-footer noprint"> <div class="panel-footer noprint">
{% if interfaces and perms.virtualization.change_vminterface %} {% if interfaces and perms.virtualization.change_vminterface %}
<button type="submit" name="_rename" formaction="{% url 'virtualization:vminterface_bulk_rename' %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-warning btn-xs"> <button type="submit" name="_rename" formaction="{% url 'virtualization:vminterface_bulk_rename' %}?return_url={{ object.get_absolute_url }}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Rename <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
</button> </button>
<button type="submit" name="_edit" formaction="{% url 'virtualization:vminterface_bulk_edit' %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-warning btn-xs"> <button type="submit" name="_edit" formaction="{% url 'virtualization:vminterface_bulk_edit' %}?return_url={{ object.get_absolute_url }}" class="btn btn-warning btn-xs">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</button> </button>
{% endif %} {% endif %}
{% if interfaces and perms.virtualization.delete_vminterface %} {% if interfaces and perms.virtualization.delete_vminterface %}
<button type="submit" name="_delete" formaction="{% url 'virtualization:vminterface_bulk_delete' %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-danger btn-xs"> <button type="submit" name="_delete" formaction="{% url 'virtualization:vminterface_bulk_delete' %}?return_url={{ object.get_absolute_url }}" class="btn btn-danger btn-xs">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</button> </button>
{% endif %} {% endif %}
{% if perms.virtualization.add_vminterface %} {% if perms.virtualization.add_vminterface %}
<div class="pull-right"> <div class="pull-right">
<a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ virtualmachine.pk }}&return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-primary btn-xs"> <a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add interfaces <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add interfaces
</a> </a>
</div> </div>

View File

@ -7,32 +7,32 @@
<div class="col-md-12"> <div class="col-md-12">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="{% url 'virtualization:virtualmachine_list' %}">Virtual Machines</a></li> <li><a href="{% url 'virtualization:virtualmachine_list' %}">Virtual Machines</a></li>
<li><a href="{{ vminterface.virtual_machine.get_absolute_url }}">{{ vminterface.virtual_machine }}</a></li> <li><a href="{{ object.virtual_machine.get_absolute_url }}">{{ object.virtual_machine }}</a></li>
<li>{{ vminterface }}</li> <li>{{ object }}</li>
</ol> </ol>
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons vminterface %} {% plugin_buttons object %}
{% if perms.virtualization.change_vminterface %} {% if perms.virtualization.change_vminterface %}
<a href="{% url 'virtualization:vminterface_edit' pk=vminterface.pk %}" class="btn btn-warning"> <a href="{% url 'virtualization:vminterface_edit' pk=object.pk %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</a> </a>
{% endif %} {% endif %}
{% if perms.virtualization.delete_vminterface %} {% if perms.virtualization.delete_vminterface %}
<a href="{% url 'virtualization:vminterface_delete' pk=vminterface.pk %}" class="btn btn-danger"> <a href="{% url 'virtualization:vminterface_delete' pk=object.pk %}" class="btn btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</a> </a>
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ vminterface.virtual_machine }} / {{ vminterface.name }}{% endblock %}</h1> <h1>{% block title %}{{ object.virtual_machine }} / {{ object.name }}{% endblock %}</h1>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ vminterface.get_absolute_url }}">Interface</a> <a href="{{ object.get_absolute_url }}">Interface</a>
</li> </li>
{% if perms.extras.view_objectchange %} {% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'virtualization:vminterface_changelog' pk=vminterface.pk %}">Change Log</a> <a href="{% url 'virtualization:vminterface_changelog' pk=object.pk %}">Change Log</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -49,17 +49,17 @@
<tr> <tr>
<td>Virtual Machine</td> <td>Virtual Machine</td>
<td> <td>
<a href="{{ vminterface.virtual_machine.get_absolute_url }}">{{ vminterface.virtual_machine }}</a> <a href="{{ object.virtual_machine.get_absolute_url }}">{{ object.virtual_machine }}</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{ vminterface.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<td>Enabled</td> <td>Enabled</td>
<td> <td>
{% if vminterface.enabled %} {% if object.enabled %}
<span class="text-success"><i class="mdi mdi-check-bold"></i></span> <span class="text-success"><i class="mdi mdi-check-bold"></i></span>
{% else %} {% else %}
<span class="text-danger"><i class="mdi mdi-close"></i></span> <span class="text-danger"><i class="mdi mdi-close"></i></span>
@ -68,27 +68,27 @@
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ vminterface.description|placeholder }} </td> <td>{{ object.description|placeholder }} </td>
</tr> </tr>
<tr> <tr>
<td>MTU</td> <td>MTU</td>
<td>{{ vminterface.mtu|placeholder }}</td> <td>{{ object.mtu|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>MAC Address</td> <td>MAC Address</td>
<td><span class="text-monospace">{{ vminterface.mac_address|placeholder }}</span></td> <td><span class="text-monospace">{{ object.mac_address|placeholder }}</span></td>
</tr> </tr>
<tr> <tr>
<td>802.1Q Mode</td> <td>802.1Q Mode</td>
<td>{{ vminterface.get_mode_display }}</td> <td>{{ object.get_mode_display }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% plugin_left_page vminterface %} {% plugin_left_page object %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'extras/inc/tags_panel.html' with tags=vminterface.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
{% plugin_right_page vminterface %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -103,7 +103,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% plugin_full_width_page vminterface %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -64,27 +64,24 @@ class TenantListView(generic.ObjectListView):
class TenantView(generic.ObjectView): class TenantView(generic.ObjectView):
queryset = Tenant.objects.prefetch_related('group') queryset = Tenant.objects.prefetch_related('group')
def get(self, request, slug): def get_extra_context(self, request, instance):
tenant = get_object_or_404(self.queryset, slug=slug)
stats = { stats = {
'site_count': Site.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'site_count': Site.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'rack_count': Rack.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'rack_count': Rack.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'rackreservation_count': RackReservation.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'rackreservation_count': RackReservation.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'device_count': Device.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'device_count': Device.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'vrf_count': VRF.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'vrf_count': VRF.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'ipaddress_count': IPAddress.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'ipaddress_count': IPAddress.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'vlan_count': VLAN.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'vlan_count': VLAN.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'circuit_count': Circuit.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'circuit_count': Circuit.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'virtualmachine_count': VirtualMachine.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'virtualmachine_count': VirtualMachine.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'cluster_count': Cluster.objects.restrict(request.user, 'view').filter(tenant=tenant).count(), 'cluster_count': Cluster.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
} }
return render(request, 'tenancy/tenant.html', { return {
'tenant': tenant,
'stats': stats, 'stats': stats,
}) }
class TenantEditView(generic.ObjectEditView): class TenantEditView(generic.ObjectEditView):

View File

@ -185,7 +185,7 @@ class UserKeyView(LoginRequiredMixin, View):
userkey = None userkey = None
return render(request, self.template_name, { return render(request, self.template_name, {
'userkey': userkey, 'object': userkey,
'active_tab': 'userkey', 'active_tab': 'userkey',
}) })
@ -205,7 +205,7 @@ class UserKeyEditView(LoginRequiredMixin, View):
form = UserKeyForm(instance=self.userkey) form = UserKeyForm(instance=self.userkey)
return render(request, self.template_name, { return render(request, self.template_name, {
'userkey': self.userkey, 'object': self.userkey,
'form': form, 'form': form,
'active_tab': 'userkey', 'active_tab': 'userkey',
}) })

View File

@ -92,23 +92,17 @@ class ClusterListView(generic.ObjectListView):
class ClusterView(generic.ObjectView): class ClusterView(generic.ObjectView):
queryset = Cluster.objects.all() queryset = Cluster.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
self.queryset = self.queryset.prefetch_related( devices = Device.objects.restrict(request.user, 'view').filter(cluster=instance).prefetch_related(
Prefetch('virtual_machines', queryset=VirtualMachine.objects.restrict(request.user))
)
cluster = get_object_or_404(self.queryset, pk=pk)
devices = Device.objects.restrict(request.user, 'view').filter(cluster=cluster).prefetch_related(
'site', 'rack', 'tenant', 'device_type__manufacturer' 'site', 'rack', 'tenant', 'device_type__manufacturer'
) )
device_table = DeviceTable(list(devices), orderable=False) device_table = DeviceTable(list(devices), orderable=False)
if request.user.has_perm('virtualization.change_cluster'): if request.user.has_perm('virtualization.change_cluster'):
device_table.columns.show('pk') device_table.columns.show('pk')
return render(request, 'virtualization/cluster.html', { return {
'cluster': cluster,
'device_table': device_table, 'device_table': device_table,
}) }
class ClusterEditView(generic.ObjectEditView): class ClusterEditView(generic.ObjectEditView):
@ -237,12 +231,10 @@ class VirtualMachineListView(generic.ObjectListView):
class VirtualMachineView(generic.ObjectView): class VirtualMachineView(generic.ObjectView):
queryset = VirtualMachine.objects.prefetch_related('tenant__group') queryset = VirtualMachine.objects.prefetch_related('tenant__group')
def get(self, request, pk): def get_extra_context(self, request, instance):
virtualmachine = get_object_or_404(self.queryset, pk=pk)
# Interfaces # Interfaces
vminterfaces = VMInterface.objects.restrict(request.user, 'view').filter( vminterfaces = VMInterface.objects.restrict(request.user, 'view').filter(
virtual_machine=virtualmachine virtual_machine=instance
).prefetch_related( ).prefetch_related(
Prefetch('ip_addresses', queryset=IPAddress.objects.restrict(request.user)) Prefetch('ip_addresses', queryset=IPAddress.objects.restrict(request.user))
) )
@ -253,20 +245,19 @@ class VirtualMachineView(generic.ObjectView):
# Services # Services
services = Service.objects.restrict(request.user, 'view').filter( services = Service.objects.restrict(request.user, 'view').filter(
virtual_machine=virtualmachine virtual_machine=instance
).prefetch_related( ).prefetch_related(
Prefetch('ipaddresses', queryset=IPAddress.objects.restrict(request.user)) Prefetch('ipaddresses', queryset=IPAddress.objects.restrict(request.user))
) )
# Secrets # Secrets
secrets = Secret.objects.restrict(request.user, 'view').filter(virtual_machine=virtualmachine) secrets = Secret.objects.restrict(request.user, 'view').filter(virtual_machine=instance)
return render(request, 'virtualization/virtualmachine.html', { return {
'virtualmachine': virtualmachine,
'vminterface_table': vminterface_table, 'vminterface_table': vminterface_table,
'services': services, 'services': services,
'secrets': secrets, 'secrets': secrets,
}) }
class VirtualMachineConfigContextView(ObjectConfigContextView): class VirtualMachineConfigContextView(ObjectConfigContextView):
@ -318,35 +309,31 @@ class VMInterfaceListView(generic.ObjectListView):
class VMInterfaceView(generic.ObjectView): class VMInterfaceView(generic.ObjectView):
queryset = VMInterface.objects.all() queryset = VMInterface.objects.all()
def get(self, request, pk): def get_extra_context(self, request, instance):
vminterface = get_object_or_404(self.queryset, pk=pk)
# Get assigned IP addresses # Get assigned IP addresses
ipaddress_table = InterfaceIPAddressTable( ipaddress_table = InterfaceIPAddressTable(
data=vminterface.ip_addresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'), data=instance.ip_addresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'),
orderable=False orderable=False
) )
# Get assigned VLANs and annotate whether each is tagged or untagged # Get assigned VLANs and annotate whether each is tagged or untagged
vlans = [] vlans = []
if vminterface.untagged_vlan is not None: if instance.untagged_vlan is not None:
vlans.append(vminterface.untagged_vlan) vlans.append(instance.untagged_vlan)
vlans[0].tagged = False vlans[0].tagged = False
for vlan in vminterface.tagged_vlans.restrict(request.user).prefetch_related('site', 'group', 'tenant', 'role'): for vlan in instance.tagged_vlans.restrict(request.user).prefetch_related('site', 'group', 'tenant', 'role'):
vlan.tagged = True vlan.tagged = True
vlans.append(vlan) vlans.append(vlan)
vlan_table = InterfaceVLANTable( vlan_table = InterfaceVLANTable(
interface=vminterface, interface=instance,
data=vlans, data=vlans,
orderable=False orderable=False
) )
return render(request, 'virtualization/vminterface.html', { return {
'vminterface': vminterface,
'ipaddress_table': ipaddress_table, 'ipaddress_table': ipaddress_table,
'vlan_table': vlan_table, 'vlan_table': vlan_table,
}) }
# TODO: This should not use ComponentCreateView # TODO: This should not use ComponentCreateView