I tried to print this in the template, but it renders blank. Whats the correct way to get URL name in template?
{{ request.resolver_match.url_name }}
I wanted it to highlight something in the top bar (if path is 'admin-stuff' add highlight class).
In the application settings TEMPLATE_CONTEXT_PROCESSORS
must include
"django.core.context_processors.request"
for the request
to appear in the template context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With