<div>
  {% if attachments %}
    {% set attachments = attachments|list %}
    <strong>Attachments:</strong>
    <div class="attachment_images">
      {% for att in attachments if att.is_image() %}
          <div class="attachment_thumb">
            <a href="{{att.url()}}">
              <img src="{{att.url()}}/thumb" alt="Thumbnail"/>
            </a><br/>
            {{att.filename}}
            {% if edit_mode %}
            <form method="post" action="{{att.url()}}">
              <input type="hidden" name="delete" value="True"/>
              <input type="submit" value="Delete File"/>
            </form>
            {% endif %}
          </div>
      {% endfor %}
    </div>

    {% for att in attachments if not att.is_image() %}
      <div>
        <form method="post" action="{{att.url()}}">
          <a href="{{att.url()}}">{{att.filename}}</a>
          ({{att.length}} bytes)
          <input type="hidden" name="delete" value="True"/>
          {% if edit_mode %}
          <span>
            <input type="submit" value="Delete File"/>
          </span>
          {% endif %}
        </form>
      </div>
    {% endfor %}
  {% endif %}
  <div style="clear:both"></div>
</div>
