M
M
maxclax2014-12-15 21:20:05
Django
maxclax, 2014-12-15 21:20:05

Django, how to find current router?

In my application, I connect the menu widget through templatetags

@register.inclusion_tag('menu/top.html')
def top():
    return {}

in the template itself I want to get the current URL. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
denizen, 2014-12-15
@maxclax

In TEMPLATE_CONTEXT_PROCESSORS add the line "django.core.context_processors.request",
and from the template you can use it like {{request.get_full_path}}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question