{# Import this module with context: {% import "widgets/tag_selector.html" as widget_tag_selector with context %} This is necessary because it uses global names from context processors. #} {% macro tag_selector(field) %} {% set all_tags = db_all_tags() %} {# When Javascript is disabled, we use the text field directly #}
{# When Javascript is enabled, use a dynamic system where the user can add and remove tags with the mouse #}
{{ field.label }}: {% for ctgy, tags in all_tags.items() %} {% for tag in tags %} {{ tag.pretty }} {% endfor %} {% endfor %}
{% if field.description %}
{{ field.description }}
{% endif %} {{ field(oninput="tag_selector_update(tag_selector_find(this))") }} {% for error in field.errors %} {{ error }} {% endfor %}
Tags disponibles :
{% for ctgy, tags in all_tags.items() %}
{% for tag in tags %} {{ tag.pretty }} {% endfor %}
{% endfor %}
{% endmacro %}