【发布时间】:2015-03-11 16:00:42
【问题描述】:
我想在我的 Django 应用程序中添加一个单独的主页。 如果用户登录,则向他显示所有内容。 如果用户未登录,则向他显示起始页和登录链接。
解决方法是基于下面的代码并不总是通过考试。
{% if user.is_authenticated %}
//Something
{% else %}
//Something
{% endif %}
我的看法:
class Start(TemplateView):
template_name = "dashboard/start.html"
【问题讨论】:
标签: python django templates authentication