Using {% url ??? %} in django templates

后端 未结 6 2317
囚心锁ツ
囚心锁ツ 2020-12-07 13:02

I have looked a lot on google for answers of how to use the \'url\' tag in templates only to find many responses saying \'You just insert it into your template and point it

6条回答
  •  太阳男子
    2020-12-07 13:56

    The url template tag will pass the parameter as a string and not as a function reference to reverse(). The simplest way to get this working is adding a name to the view:

    url(r'^/logout/' , logout_view, name='logout_view')
    

提交回复
热议问题