【发布时间】:2014-06-10 17:30:38
【问题描述】:
我正在尝试使用 django-allauth 并从我的自定义模板中提供指向 allauth 视图的链接。下面是相关的模板代码:
{% if request.user.is_authenticated %}
<a href="{% url 'allauth.account.views.logout' %}">Sign Out</a>
{% else %}
<a href="#user-form" class="popup-with-form">Login</a> <a href="#user-form2" class="popup-with-form2">Register</a>
{% endif %}
这是检查用户是否通过身份验证,如果是,则提供注销链接。我在过去的项目中使用了这个确切的代码,没有任何问题。在那些项目中,我使用了django-allauth==0.12.0。我认为我的问题可能是我在这个项目中使用了最新版本的 allauth (0.16.x),但即使我回滚到0.12.0,我仍然遇到同样的错误。感谢您的帮助。
编辑:我得到的错误是
NoReverseMatch at /app/
Reverse for 'allauth.account.views.logout' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
【问题讨论】:
-
什么错误?和 Django 的版本?
-
抱歉,我的问题中包含了我的错误。
标签: python django django-allauth