V
V
Vitaly2016-07-07 09:56:44
Django
Vitaly, 2016-07-07 09:56:44

How to get a link in a template by name in Django?

How to display link by name in Django template?
There is a projectname/urls.py file

urlpatterns = [
    .....
    url(r'^logout/$', log_out, name='logout'),
    .....
]

How can I get this link in projectname/app_name/templates/base.html template?
UPD: {% url 'logout' %} doesn't work
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaliy, 2016-07-11
@MrCute

Solution: {% url 'logout' %}
Everything worked!

A
Andrey K, 2016-07-07
@mututunus

https://docs.djangoproject.com/en/1.9/ref/template...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question