diff --git a/netbox/extras/views.py b/netbox/extras/views.py
index 10bf2f6c8..b23dc0230 100644
--- a/netbox/extras/views.py
+++ b/netbox/extras/views.py
@@ -276,6 +276,21 @@ class ConfigContextView(generic.ObjectView):
queryset = ConfigContext.objects.all()
def get_extra_context(self, request, instance):
+ # Gather assigned objects for parsing in the template
+ assigned_objects = (
+ ('Regions', instance.regions.all),
+ ('Site Groups', instance.site_groups.all),
+ ('Sites', instance.sites.all),
+ ('Device Types', instance.device_types.all),
+ ('Roles', instance.roles.all),
+ ('Platforms', instance.platforms.all),
+ ('Cluster Groups', instance.cluster_groups.all),
+ ('Clusters', instance.clusters.all),
+ ('Tenant Groups', instance.tenant_groups.all),
+ ('Tenants', instance.tenants.all),
+ ('Tags', instance.tags.all),
+ )
+
# Determine user's preferred output format
if request.GET.get('format') in ['json', 'yaml']:
format = request.GET.get('format')
@@ -287,6 +302,7 @@ class ConfigContextView(generic.ObjectView):
format = 'json'
return {
+ 'assigned_objects': assigned_objects,
'format': format,
}
diff --git a/netbox/templates/circuits/circuit.html b/netbox/templates/circuits/circuit.html
index ec1369e1b..7b22c5d65 100644
--- a/netbox/templates/circuits/circuit.html
+++ b/netbox/templates/circuits/circuit.html
@@ -66,18 +66,7 @@
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:circuit_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_left_page object %}
diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html
index 9434d99ec..4d35da0e6 100644
--- a/netbox/templates/circuits/provider.html
+++ b/netbox/templates/circuits/provider.html
@@ -52,18 +52,7 @@
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:provider_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_right_page object %}
diff --git a/netbox/templates/circuits/providernetwork.html b/netbox/templates/circuits/providernetwork.html
index 49f34e922..a5eac1f78 100644
--- a/netbox/templates/circuits/providernetwork.html
+++ b/netbox/templates/circuits/providernetwork.html
@@ -37,20 +37,9 @@
{% plugin_left_page object %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:providernetwork_list' %}
+ {% include 'inc/comments_panel.html' %}
{% plugin_right_page object %}
diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html
index 162e201b1..72e42129c 100644
--- a/netbox/templates/dcim/device.html
+++ b/netbox/templates/dcim/device.html
@@ -210,18 +210,7 @@
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:device_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_left_page object %}
diff --git a/netbox/templates/dcim/devicetype.html b/netbox/templates/dcim/devicetype.html
index ad6853877..cd3da3efa 100644
--- a/netbox/templates/dcim/devicetype.html
+++ b/netbox/templates/dcim/devicetype.html
@@ -126,18 +126,7 @@
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:devicetype_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_right_page object %}
diff --git a/netbox/templates/dcim/powerfeed.html b/netbox/templates/dcim/powerfeed.html
index 0632cff4c..b4fb06081 100644
--- a/netbox/templates/dcim/powerfeed.html
+++ b/netbox/templates/dcim/powerfeed.html
@@ -182,18 +182,7 @@
{% endif %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_right_page object %}
diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html
index 631dbf9f3..0a278f2d6 100644
--- a/netbox/templates/dcim/rack.html
+++ b/netbox/templates/dcim/rack.html
@@ -168,18 +168,7 @@
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:rack_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% if power_feeds %}
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:site_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_left_page object %}
diff --git a/netbox/templates/extras/configcontext.html b/netbox/templates/extras/configcontext.html
index 0b6cc9eab..3a9cc2e0c 100644
--- a/netbox/templates/extras/configcontext.html
+++ b/netbox/templates/extras/configcontext.html
@@ -50,132 +50,20 @@
+ {% for title, objects in assigned_objects %}
- Regions |
-
- {% if object.regions.all %}
-
- {% for region in object.regions.all %}
- - {{ region }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Sites |
-
- {% if object.sites.all %}
-
- {% for site in object.sites.all %}
- - {{ site }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Roles |
-
- {% if object.roles.all %}
-
- {% for role in object.roles.all %}
- - {{ role }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Platforms |
-
- {% if object.platforms.all %}
-
- {% for platform in object.platforms.all %}
- - {{ platform }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Cluster Groups |
-
- {% if object.cluster_groups.all %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Clusters |
-
- {% if object.clusters.all %}
-
- {% for cluster in object.clusters.all %}
- - {{ cluster }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Tenant Groups |
-
- {% if object.tenant_groups.all %}
-
- {% for tenant_group in object.tenant_groups.all %}
- - {{ tenant_group }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Tenants |
-
- {% if object.tenants.all %}
-
- {% for tenant in object.tenants.all %}
- - {{ tenant }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
-
-
- Tags |
-
- {% if object.tags.all %}
-
- {% for tag in object.tags.all %}
- - {{ tag }}
- {% endfor %}
-
- {% else %}
- None
- {% endif %}
- |
+ {{ title }} |
+
+
+ {% for object in objects %}
+ - {{ object }}
+ {% empty %}
+ - None
+ {% endfor %}
+
+ |
+ {% endfor %}
diff --git a/netbox/templates/extras/journalentry.html b/netbox/templates/extras/journalentry.html
index 2862fb8bc..925d98b41 100644
--- a/netbox/templates/extras/journalentry.html
+++ b/netbox/templates/extras/journalentry.html
@@ -45,14 +45,7 @@
-
-
-
- {{ object.comments|render_markdown }}
-
-
+ {% include 'inc/comments_panel.html' %}
{% endblock %}
diff --git a/netbox/templates/inc/comments_panel.html b/netbox/templates/inc/comments_panel.html
new file mode 100644
index 000000000..bfacb25bf
--- /dev/null
+++ b/netbox/templates/inc/comments_panel.html
@@ -0,0 +1,14 @@
+{% load helpers %}
+
+
+
+
+ {% if object.comments %}
+ {{ object.comments|render_markdown }}
+ {% else %}
+ None
+ {% endif %}
+
+
diff --git a/netbox/templates/tenancy/tenant.html b/netbox/templates/tenancy/tenant.html
index 7d251739b..dee7f7ce7 100644
--- a/netbox/templates/tenancy/tenant.html
+++ b/netbox/templates/tenancy/tenant.html
@@ -37,18 +37,7 @@
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='tenancy:tenant_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_left_page object %}
diff --git a/netbox/templates/virtualization/cluster.html b/netbox/templates/virtualization/cluster.html
index 402ec71bc..769ae431f 100644
--- a/netbox/templates/virtualization/cluster.html
+++ b/netbox/templates/virtualization/cluster.html
@@ -56,18 +56,7 @@
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_left_page object %}
diff --git a/netbox/templates/virtualization/virtualmachine.html b/netbox/templates/virtualization/virtualmachine.html
index 339a82e65..6ea4e8d7c 100644
--- a/netbox/templates/virtualization/virtualmachine.html
+++ b/netbox/templates/virtualization/virtualmachine.html
@@ -91,18 +91,7 @@
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:virtualmachine_list' %}
-
-
-
- {% if object.comments %}
- {{ object.comments|render_markdown }}
- {% else %}
- None
- {% endif %}
-
-
+ {% include 'inc/comments_panel.html' %}
{% plugin_left_page object %}