{% for field_name, field_errors in form.errors.items() %}
<p>{{ field_name }}
  <ul>
    {% for error in field_errors %}
    <li>{{ error }}</li>
    {% endfor %}
  </ul>
</p>
{% endfor %}

<form method="POST">
  {{ form.hidden_tag() }}

  <table id="language">
  <tbody>

    {% for field in form %}
    {% if field.name != 'csrf_token' %}
    <tr>
      <td>{{ field.label(class="form-control-label") }}</td>
      <td>{{ field(class="form-control") }}</td>
    </tr>
    {% endif %}
    {% endfor %}

  </tbody>
  </table>

  <button id="submit" type="submit" class="btn btn-primary">Save</button>
</form>

{% if language.id %}
<form method="post" action="/language/delete/{{ language.id }}" onsubmit="return confirm('WARNING: deleting a language deletes all its books and defined terms.  Are you *absolutely* sure you want to delete this item?');">
    <button class="btn">Delete</button>
</form>
{% endif %}

<button onclick="window.location = '{{ url_for('language.index') }}'">Cancel</button>
