成功登录后首页依然显示登录和注册按钮

来源:6-3 用户登录-2

慕粉13621823258

2017-04-24

{% if request.user.is_authenticate %}
         <div class="top">
             <div class="wp">
                 <div class="fl"><p>服务电话:<b>33333333</b></p></div>
                     <div class="personal">
                         <dl class="user fr">
                             <dd>bobby<img class="down fr" src="../images/top_down.png"/></dd>
                             <dt><img width="20" height="20" src="../media/image/2016/12/default_big_14.png"/></dt>
                         </dl>
                         <div class="userdetail">
                             <dl>
                                 <dt><img width="80" height="80" src="../media/image/2016/12/default_big_14.png"/></dt>
                                 <dd>
                                     <h2>django</h2>
                                     <p>bobby</p>
                                 </dd>
                             </dl>
                             <div class="btn">
                                 <a class="personcenter fl" href="usercenter-info.html">进入个人中心</a>
                                 <a class="fr" href="/logout/">退出</a>
                             </div>
                         </div>
                     </div>
             </div>
</div>
         {% else %}
             <div class="top">
                 <div class="wp">
                     <div class="fl"><p>服务电话:<b>33333333</b></p></div>
                     <!--登录后跳转-->
                     <a style="color:white" class="fr registerbtn" href="register.html">注册</a>
                     <a style="color:white" class="fr loginbtn" href="/login/">登录</a>
                 </div>
             </div>
     {% endif %}


写回答

1回答

慕粉13621823258

提问者

2017-04-24

问题已经解决了 :{% if request.user.is_authenticate %}写错了应该是{% if request.user.is_authenticated %}

0
0

Python3.6+django+xadmin,打造在线教育平台

【毕设】Python 2.7到3.6 完美适配,Django升级2.0

3677 学习 · 4038 问题

查看课程