From e8896fe238b098d330916610bd0af789c922dfce Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 16 Feb 2017 15:13:35 -0500 Subject: [PATCH] Closes #898: Expand circuits list in provider view --- netbox/circuits/views.py | 3 +- netbox/templates/circuits/provider.html | 46 +++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index de5ef1a22..466104883 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -31,7 +31,8 @@ class ProviderListView(ObjectListView): def provider(request, slug): provider = get_object_or_404(Provider, slug=slug) - circuits = Circuit.objects.filter(provider=provider) + circuits = Circuit.objects.filter(provider=provider).select_related('type', 'tenant')\ + .prefetch_related('terminations__site') show_graphs = Graph.objects.filter(type=GRAPH_TYPE_PROVIDER).exists() return render(request, 'circuits/provider.html', { diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html index c9c8b9742..5465b8599 100644 --- a/netbox/templates/circuits/provider.html +++ b/netbox/templates/circuits/provider.html @@ -48,7 +48,7 @@

{{ provider }}

{% include 'inc/created_updated.html' with obj=provider %}
-
+
Provider @@ -104,6 +104,12 @@ {% endif %} + + Circuits + + {{ provider.circuits.count }} + +
{% with provider.get_custom_fields as custom_fields %} @@ -122,12 +128,20 @@
-
+
Circuits
+ + + + + + + + {% for c in circuits %} + + + + {% empty %}
Circuit IDTypeTenantA SideZ SideDescription
@@ -136,6 +150,34 @@ {{ c.type }} + {% if c.tenant %} + {{ c.tenant }} + {% else %} + + {% endif %} + + {% if c.termination_a %} + {{ c.termination_a.site }} + {% else %} + + {% endif %} + + {% if c.termination_z %} + {{ c.termination_z.site }} + {% else %} + + {% endif %} + + {% if c.description %} + {{ c.description }} + {% else %} + + {% endif %} +