简体   繁体   English

Django 1.6:登录重定向按钮在Firefox和Safari上不起作用

[英]Django 1.6: Login redirection button not working on Firefox and Safari

I have this in my template to allow people to post reviews. 我的模板中有此标签,允许人们发布评论。 If the user is not logged in it takes him to the login page when clicked on the write review button, and then redirect backs to the same page upon successful login. 如果用户未登录,则在单击“写审阅”按钮时将其带到登录页面,然后在成功登录后重定向回同一页面。 It works fine on Chrome but when used on Firefox and Safari nothing happens when the button is clicked. 它在Chrome上运行良好,但在Firefox和Safari上使用时,单击该按钮则没有任何反应。

  {% if user.is_authenticated and reviewed == True  %}
  <h4><a class="writebtn"href="">Already Reviewed!</a></h4>

  {% else %}
  <button class="btn btn-primary"><a class="writebtn"href="{% url 'login' %}?next={{ request.path }}">Write Review</a></button>

  {% endif %}

urls.py urls.py

url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'meddy1/login.html'}, name="login"),

I'm also using bootstrap for the frontend. 我还在前端使用引导程序。

Replace 更换

<button class="btn btn-primary"><a class="writebtn"href="{% url 'login' %}?next={{ request.path }}">Write Review</a></button>

with

<a class="btn btn-primary writebtn" href="{% url 'login' %}?next={{ request.path }}">Write Review</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM