{% load crispy_forms_field crispy_forms_tags i18n %}
<fieldset>
  <legend>{{ form.legend }}</legend>

  <table class="table table-striped table-permissions">
    {% for field in form %}
    <tr{% if field.errors %} class="text-danger"{% endif %}>
      <td class="col-md-8">
        <label>{{ field.label }}:</label>
        {% for error in field.errors %}
        <p class="small"><strong>{{ error }}</strong></p>
        {% endfor %}
        {% if field.help_text %}
        <p class="text-muted small">{{ field.help_text }}</p>
        {% endif %}
      </td>
      <td>
        <div class="form-group{% if field.errors %} has-error{% endif %}">
          {% if field|is_checkboxselectmultiple %}
            {% include 'bootstrap3/layout/checkboxselectmultiple.html' %}
          {% endif %}

          {% if field|is_radioselect %}
            {% include 'bootstrap3/layout/radioselect.html' with hide_help_text=1 %}
          {% endif %}

          {% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
          {% crispy_field field %}
          {% endif %}
        </div>
      </td>
    </tr>
    {% endfor %}
  </table>

</fieldset>
