Django update url template tag

Django -- Posted on Aug. 5, 2024

django update url template tag

              
                from django import template
from django.urls import reverse
from django.apps import apps
register = template.Library()


@register.simple_tag
def get_update_url(object):
    return reverse(f"{object._meta.app_label}:{object.__class__.__name__.lower()}-update",kwargs={"pk":object.pk})
                  
   
            

Related Posts