1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Added template tag for tag links

This commit is contained in:
Jeremy Stretch
2018-05-18 11:09:11 -04:00
parent 5247f10d7e
commit e6b3983a4e
17 changed files with 122 additions and 16 deletions

View File

@@ -1,7 +1,6 @@
from __future__ import unicode_literals
import datetime
import pytz
from django import template
from django.utils.safestring import mark_safe
@@ -160,3 +159,14 @@ def utilization_graph(utilization, warning_threshold=75, danger_threshold=90):
'warning_threshold': warning_threshold,
'danger_threshold': danger_threshold,
}
@register.inclusion_tag('utilities/templatetags/tag.html')
def tag(url_name, tag):
"""
Display a link to the given object list filtered by a specific Tag slug.
"""
return {
'url_name': url_name,
'tag': tag,
}