Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL name in django template.if statement

How to add correctly in my example {% url 'myview' %}

{% if request.path == {% url 'myview' %} %}

?

like image 945
user2613717 Avatar asked Jul 24 '13 09:07

user2613717


1 Answers

Django has this nice built-in feature that you can assign the url to a variable and then use it:

{% url 'myview' as my_view %}
{% if request.path == my_view %}
like image 105
alecxe Avatar answered Nov 15 '22 08:11

alecxe