From edf53d451668d2a03b4c462cb353ff38a40079a7 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 5 Jul 2018 15:20:13 -0400 Subject: [PATCH] Flip the order of tag and URL name for the tag template tag --- netbox/templates/circuits/circuit.html | 2 +- netbox/templates/circuits/provider.html | 2 +- netbox/templates/dcim/device.html | 2 +- netbox/templates/dcim/devicetype.html | 2 +- netbox/templates/dcim/rack.html | 2 +- netbox/templates/dcim/site.html | 2 +- netbox/templates/ipam/aggregate.html | 2 +- netbox/templates/ipam/ipaddress.html | 2 +- netbox/templates/ipam/prefix.html | 2 +- netbox/templates/ipam/vlan.html | 2 +- netbox/templates/ipam/vrf.html | 2 +- netbox/templates/secrets/secret.html | 2 +- netbox/templates/tenancy/tenant.html | 2 +- netbox/templates/utilities/templatetags/tag.html | 6 +++++- netbox/templates/virtualization/cluster.html | 2 +- netbox/templates/virtualization/virtualmachine.html | 2 +- netbox/utilities/templatetags/helpers.py | 6 +++--- 17 files changed, 23 insertions(+), 19 deletions(-) diff --git a/netbox/templates/circuits/circuit.html b/netbox/templates/circuits/circuit.html index 048c16862..da7332a7c 100644 --- a/netbox/templates/circuits/circuit.html +++ b/netbox/templates/circuits/circuit.html @@ -127,7 +127,7 @@ Tags {% for tag in circuit.tags.all %} - {% tag 'circuits:circuit_list' tag %} + {% tag tag 'circuits:circuit_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html index d2fed8647..1a8258280 100644 --- a/netbox/templates/circuits/provider.html +++ b/netbox/templates/circuits/provider.html @@ -119,7 +119,7 @@ Tags {% for tag in provider.tags.all %} - {% tag 'circuits:provider_list' tag %} + {% tag tag 'circuits:provider_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 8a8bf5086..a42fc0a7b 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -173,7 +173,7 @@ Tags {% for tag in device.tags.all %} - {% tag 'dcim:device_list' tag %} + {% tag tag 'dcim:device_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/dcim/devicetype.html b/netbox/templates/dcim/devicetype.html index 151e27018..821f00dea 100644 --- a/netbox/templates/dcim/devicetype.html +++ b/netbox/templates/dcim/devicetype.html @@ -89,7 +89,7 @@ Tags {% for tag in devicetype.tags.all %} - {% tag 'dcim:devicetype_list' tag %} + {% tag tag 'dcim:devicetype_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html index 5ff8a3259..024835d6d 100644 --- a/netbox/templates/dcim/rack.html +++ b/netbox/templates/dcim/rack.html @@ -129,7 +129,7 @@ Tags {% for tag in rack.tags.all %} - {% tag 'dcim:rack_list' tag %} + {% tag tag 'dcim:rack_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html index 442242214..9979c4d36 100644 --- a/netbox/templates/dcim/site.html +++ b/netbox/templates/dcim/site.html @@ -149,7 +149,7 @@ Tags {% for tag in site.tags.all %} - {% tag 'dcim:site_list' tag %} + {% tag tag 'dcim:site_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/ipam/aggregate.html b/netbox/templates/ipam/aggregate.html index 2a87ae769..1e72e0cf6 100644 --- a/netbox/templates/ipam/aggregate.html +++ b/netbox/templates/ipam/aggregate.html @@ -97,7 +97,7 @@ Tags {% for tag in aggregate.tags.all %} - {% tag 'ipam:aggregate_list' tag %} + {% tag tag 'ipam:aggregate_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/ipam/ipaddress.html b/netbox/templates/ipam/ipaddress.html index dea0d45ac..d19783152 100644 --- a/netbox/templates/ipam/ipaddress.html +++ b/netbox/templates/ipam/ipaddress.html @@ -149,7 +149,7 @@ Tags {% for tag in ipaddress.tags.all %} - {% tag 'ipam:ipaddress_list' tag %} + {% tag tag 'ipam:ipaddress_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/ipam/prefix.html b/netbox/templates/ipam/prefix.html index 0dc5fc338..3813b7b56 100644 --- a/netbox/templates/ipam/prefix.html +++ b/netbox/templates/ipam/prefix.html @@ -189,7 +189,7 @@ Tags {% for tag in prefix.tags.all %} - {% tag 'ipam:prefix_list' tag %} + {% tag tag 'ipam:prefix_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/ipam/vlan.html b/netbox/templates/ipam/vlan.html index 26e51c9e7..8ce695cb2 100644 --- a/netbox/templates/ipam/vlan.html +++ b/netbox/templates/ipam/vlan.html @@ -141,7 +141,7 @@ Tags {% for tag in vlan.tags.all %} - {% tag 'ipam:vlan_list' tag %} + {% tag tag 'ipam:vlan_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/ipam/vrf.html b/netbox/templates/ipam/vrf.html index b8365463b..4b8f04c43 100644 --- a/netbox/templates/ipam/vrf.html +++ b/netbox/templates/ipam/vrf.html @@ -94,7 +94,7 @@ Tags {% for tag in vrf.tags.all %} - {% tag 'ipam:vrf_list' tag %} + {% tag tag 'ipam:vrf_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/secrets/secret.html b/netbox/templates/secrets/secret.html index 6e1175f41..8c23dea04 100644 --- a/netbox/templates/secrets/secret.html +++ b/netbox/templates/secrets/secret.html @@ -71,7 +71,7 @@ Tags {% for tag in secret.tags.all %} - {% tag 'secrets:secret_list' tag %} + {% tag tag 'secrets:secret_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/tenancy/tenant.html b/netbox/templates/tenancy/tenant.html index ee1691b4d..3559012b3 100644 --- a/netbox/templates/tenancy/tenant.html +++ b/netbox/templates/tenancy/tenant.html @@ -83,7 +83,7 @@ Tags {% for tag in tenant.tags.all %} - {% tag 'tenancy:tenant_list' tag %} + {% tag tag 'tenancy:tenant_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/utilities/templatetags/tag.html b/netbox/templates/utilities/templatetags/tag.html index 79e1627db..09b885d42 100644 --- a/netbox/templates/utilities/templatetags/tag.html +++ b/netbox/templates/utilities/templatetags/tag.html @@ -1 +1,5 @@ -{{ tag }} +{% if url_name %} + {{ tag }} +{% else %} + {{ tag }} +{% endif %} diff --git a/netbox/templates/virtualization/cluster.html b/netbox/templates/virtualization/cluster.html index 71699bafe..2fc472877 100644 --- a/netbox/templates/virtualization/cluster.html +++ b/netbox/templates/virtualization/cluster.html @@ -91,7 +91,7 @@ Tags {% for tag in cluster.tags.all %} - {% tag 'virtualization:cluster_list' tag %} + {% tag tag 'virtualization:cluster_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/templates/virtualization/virtualmachine.html b/netbox/templates/virtualization/virtualmachine.html index 9b5dbc471..4038c3d7a 100644 --- a/netbox/templates/virtualization/virtualmachine.html +++ b/netbox/templates/virtualization/virtualmachine.html @@ -139,7 +139,7 @@ Tags {% for tag in virtualmachine.tags.all %} - {% tag 'virtualization:virtualmachine_list' tag %} + {% tag tag 'virtualization:virtualmachine_list' %} {% empty %} N/A {% endfor %} diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index 9edf4ad36..39959a668 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -171,11 +171,11 @@ def utilization_graph(utilization, warning_threshold=75, danger_threshold=90): @register.inclusion_tag('utilities/templatetags/tag.html') -def tag(url_name, tag): +def tag(tag, url_name=None): """ - Display a link to the given object list filtered by a specific Tag slug. + Display a tag, optionally linked to a filtered list of objects. """ return { - 'url_name': url_name, 'tag': tag, + 'url_name': url_name, }