2
在Django網站發表評論後,我怎樣才能擺脫用戶被引導到「謝謝 您的評論」頁面?我希望用戶將 重定向到他們評論的同一頁面。我正在使用Django 評論。Django評論 - 重定向
我試着加入:
<input type=」hidden」 name=」next」 value=」"{% url
django.contrib.comments.views.comments.comment_done %}" />
但它不工作。下面是代碼在我的意見/ form.html
{% load comments %}
{% get_comment_count for sol as comment_count %}
{% get_comment_list for sol as comment_list %}
{% get_comment_form for sol as form %}
{% if user.is_authenticated %}
<form action="{% comment_form_target %}" method="post">
{% csrf_token %}
{% if next %}<input type="hidden" name="next" value="{% url
django.contrib.comments.views.comments.comment_done %}" />{% endif %}
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
{% if field.name != "name" and field.name != "email"
and field.name != "url" %}
{% if field.errors %}{{ field.errors }}{% endif %}
{{ field }}
{% endif %}
{% endif %}
{% endfor %}
<input class="submit-post" name="post" type="submit" value="Comment" />
</form>
{% else %}
I'm sorry, but you must be <a href="javascript:alert('send to
login page')">logged in</a> to submit comments.
{% endif %}
非常感謝!它正在工作。 :) – picomon 2012-02-24 03:21:12
沒問題,你能接受答案嗎? – jpic 2012-02-24 09:00:10