Template tag to get url

Django -- Posted on July 31, 2017

Template tag to get url

              
                from django import template
from django.urls import reverse_lazy

register = template.Library()


@register.filter(name='geturl')
def geturl(value):
    """Return the url from a string value"""
    return reverse_lazy(value)
                  
   
            

Related Posts