tags:

views:

39

answers:

0

I' using django 1.1.1 and its comment framework. But the "preview" button in the comment form always posts the comment directly without previewing it. I've edited both forms.html and preview.html.

forms.html

{% load comments i18n %}

<form class="form2 mt10 padding5" action="{% comment_form_target %}" method="post">
    <input type="hidden" name="next" value="{{request.path}}" />    
    ............
    ............        
  <p class="submit">
    <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" />
    <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
  </p>

</form>

preview.html

{% extends 'base.html' %}
{% load comments i18n %}

{% block content %}
 <div id="content">   
<div id="commentFormWrapper">
    <h3 class="center mt5">Post a Comment</h3>
    <form class="form2 mt10 padding5" action="{% comment_form_target %}" method="POST">

     {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
    ...................
    ..................
    <p class="submit">
      <input type="submit" name="submit" class="submit-post" value="Post">
      <input type="submit" name="preview" class="submit-preview" value="Preview">
    </p>
  </form>
  </div>
  </div>
{% endblock %}

and, in my object page( where comment form will be displayed) I used:

   <div id="commentFormWrapper">
        <h3 class="head-bg center mt5">Post a Comment</h3>
        {% render_comment_form for idea %}
    </div>