{% load comments i18n %}
{% load firstof from future %}
<form action="{% comment_form_target %}" method="post" id="comment-form">
  <div>{% csrf_token %}</div>
  {% if form.non_field_errors %}
  <div class="error">
    {{ form.non_field_errors }}
  </div>
  {% endif %}
  <fieldset>
    <a id="cancel-comment-reply" href="#comment-form" style="display:none;">{% trans "Cancel reply" %}</a>
    <legend>{% trans "Post your comment" %}</legend>
    <input type="hidden" name="next" value="{% url 'zinnia:comment_success' %}"/>
    {% for field in form %}
    {% if field.is_hidden %}{{ field }}{% else %}
    {% if user.email and field.name in "namemailurl" %}{% else %}
    <div{% if field.errors %} class="error"{% endif %}{% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
      {{ field.label_tag }}
      {% if field.errors %}{{ field.errors }}{% endif %}
      {{ field }}
    </div>
    {% endif %}
    {% endif %}
    {% endfor %}
    {% if user.is_authenticated %}
    <p class="auth">
      {% trans "Comment as" %} <strong>{% firstof user.get_full_name user.get_username %}</strong>. <a href="{% url 'admin:logout' %}">{% trans "Log out" %}</a>.
    </p>
    {% endif %}
    <p class="submit">
      <input type="submit" name="submit" class="submit-post" value="{% trans "Post" %}" />
      <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
    </p>
  </fieldset>
</form>
