diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index 1cd0932..2123b5e 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -1,4 +1,4 @@ -{% load i18n static %} +{% load i18n static startswith %} @@ -80,97 +80,122 @@ diff --git a/dashboard/templatetags/startswith.py b/dashboard/templatetags/startswith.py new file mode 100644 index 0000000..62d0867 --- /dev/null +++ b/dashboard/templatetags/startswith.py @@ -0,0 +1,9 @@ +#https://medium.com/@malvin.lok/add-a-custom-function-startwith-on-the-django-template-f11e1916f0d1 +from django import template + +register = template.Library() + + +@register.filter('startswith') +def startswith(value, prefixes): + return any(value.startswith(prefix) for prefix in prefixes.split(','))