{###############################################################################}
{##}
{#   Copyright (C) <2016>  <Florian Alu - Prolibre - http://prolibre.com>#}
{##}
{#    This program is free software: you can redistribute it and/or modify#}
{#    it under the terms of the GNU Affero General Public License as published#}
{#    by the Free Software Foundation, either version 3 of the License.#}
{#    #}
{##}
{#    This program is distributed in the hope that it will be useful,#}
{#    but WITHOUT ANY WARRANTY; without even the implied warranty of#}
{#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the#}
{#    GNU Affero General Public License for more details.#}
{##}
{#    You should have received a copy of the GNU Affero General Public License#}
{#    along with this program.  If not, see <http://www.gnu.org/licenses/>.#}
{##}
{###############################################################################}

{% load crispy_forms_filters %}
{% load l10n %}
{% load static %}

<div class="controls {{ field_class }}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
  {% include 'layout/field_errors_block.html' %}

  {% for choice in field.field.choices %}
    {% if not inline_class %}
      <div class="radio">{% endif %}
  <label class="{% if inline_class %}radio-{{ inline_class }}{% endif %}">
    <input type="radio"{% if choice.0|stringformat:"s" == field.value|stringformat:"s" %}
           checked="checked"{% endif %} name="{{ field.html_name }}"
           id="id_{{ field.html_name }}_{{ forloop.counter }}"
           value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>
    {% if choice.0 == None or choice.0 == "" %}
      <img class='img-fluid' width="100px" src='{% static "img/smiley/question.png" %}'/>
    {% else %}
      <img class='img-fluid' width="100px" src='{% static "img/smiley/" %}{{ choice.1|unlocalize }}'/>
    {% endif %}
  </label>
  {% if not inline_class %}</div>{% endif %}
  {% endfor %}

  {% include 'layout/help_text.html' %}
</div>
