{% if result_hidden_fields %}
<div class="hiddenfields">{# DIV for HTML validation #}
{% for item in result_hidden_fields %}{{ item }}{% endfor %}
</div>
{% endif %}
{% if results %}
  <table cellspacing="0" id="result_list">
    <thead>
      <tr>
        <th>Quick Links</th>
        {% for header in result_headers %}
          <th{{ header.class_attrib }}>
            {% if header.sortable %} <a href="{{ header.url }}">{% endif %}
            {{ header.text|capfirst }}
            {% if header.sortable %}</a>{% endif %}
          </th>
        {% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for result in results %}
        {% if result.form.non_field_errors %}
          <tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr>
        {% endif %}
        {% url admin:stories_story_change result.quickedit.instance.pk as change_url %}
        <tr class="{% cycle 'row1' 'row2' %}">
          <td>
            <div class="qe-buttons">
              <a href="{{ change_url }}">
                <img src="{{ STATIC_URL }}img/019.png" alt="Edit" title="Edit this item" width="10" height="10">
              </a>
              <a href="#" class="quickedit" id="quickedit-{{ result.quickedit.instance.pk }}">
                <img src="{{ STATIC_URL }}img/133.png" alt="Quick Edit" title="Show Quick Edit form" width="10" height="10">
              </a>
              <a href="{{ result.quickedit.instance.get_absolute_url }}" target="_blank">
                <img src="{{ STATIC_URL }}img/049.png" alt="View on site" title="View on site" width="10" height="10">
              </a>
            </div>
          </td>
          {% for item in result.fields %}{{ item }}{% endfor %}
        </tr>
        <tr class="quickedit-row {% cycle 'row1' 'row2' %}" id="qe-form-{{ result.quickedit.instance.pk }}"{% if not result.quickedit.errors %} style="display: none;{% endif %}">
          <td>&nbsp;</td>
          <td colspan="{{ result.fields|length }}" >
            <table border="0" class="qe-table">
              <tr>
                <td>
                  {% if result.quickedit.non_field_errors %}
                    {{ result.quickedit.non_field_errors }}
                  {% endif %}
                  <fieldset class="module aligned">
                    {% for field in result.quickedit.visible_fields %}
                      <div class="form-row{% if field.errors %} errors{% endif %} {{ field.name }}">
                        {{ field.errors }}
                        {{ field.label_tag }}
                        {{ field }}
                      </div>
                    {% endfor %}
                  </fieldset>
                </td>
              </tr>
              <tr>
                <td>
                  <input type="reset" value="Reset" class="qe-reset">
                  <input type="submit" value="Save" class="qe-button" name="_save">
                </td>
              </tr>
            </table>
          </td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
{% endif %}
