{# Created on Mon Jan 24 13:32:00 2022 @author: alica.burlot #}
{# base template for all forms #}
{# to be extended in the templates where a form is displayed #}
{# Check django comments for more information #}
{# extends your base.html template #}
{% extends "django_village/base.html" %}
{% load static village_tags widget_tweaks %}
{% comment %}
Radio button and multiple checkboxes :
    -Help text under each button/checkbox :
        In your forms.py, in the ChoiceField or MultipleChoiceField,
        instead of choices=(("a", "label a"), ("b", "label b"), ...),
        put choices=(("a", {"label":"label a", "help_text":"help text a"}), ("b", {"label":"label b", "help_text":"help text b"})),

    -Horizontal list of buttons/checkboxes :
        In your forms.py, in the RadioSelect widget or the CheckboxSelectMultiple widget,
        put attrs={"class":"village-fieldset--inline"}
{% endcomment %}
{% block extra_css %}
{% endblock extra_css %}
{% block content %}
  {# Everything that needs to be outside the form, before #}
  {% block before_form %}
  {% endblock before_form %}
  <div id="form">
    <form method="post" enctype="multipart/form-data" id="form-base">
      {% csrf_token %}
      {# Everything that needs to be in the form but before the fields (form title for example) #}
      {% block head_form %}
      {% endblock head_form %}
      {# If you need to add formsets before the form #}
      {% block extra_formset_before %}
      {% endblock extra_formset_before %}
      {# The fields #}
      {% for field in form.visible_fields %}
        {# Everything that needs to be in the for loop #}
        {% block inside_form %}
        {% endblock inside_form %}
        {% include "django_village/form_field_snippets/field_snippet.html" %}
      {% endfor %}
      {# If you need to add formsets after the form #}
      {% block extra_formset_after %}
      {% endblock extra_formset_after %}
      {# Everything that needs to be in the form but after the fields (the buttons for example) #}
      <div class="foot-form">
        {% block foot_form %}
        {% endblock foot_form %}
      </div>
    </form>
  </div>
  {# Everything that needs to be outside the form, after #}
  {% block after_form %}
  {% endblock after_form %}
{% endblock content %}
