EditionPN/app/templates/form.html
2021-05-10 12:11:01 +02:00

70 lines
2.6 KiB
HTML

{% macro render_field(field,class) %}
<div class="field">
<label class="label">{{ field.label }}</label>
<div class="control">
{{ field(class=class)}}
</div>
{% for error in field.errors %}
<p class="help is-danger">{{error}}</p>
{% endfor %}
</div>
{% endmacro %}
{% extends "base.html" %}
{% block content %}
<form action="" enctype=multipart/form-data method="post" novalidate>
{{ form.hidden_tag() }}
<div class="content">
<h1 class="title">{% block form_title %}{% endblock %}</h1>
{% block formulaire %}{% endblock %}
<div class="field is-grouped">
<div class="control">
{{ form.sauvegarder(class="button")}}
</div>
<div class="control">
{{ form.charger(class="button")}}
</div>
<div class="control">
{{ form.exporter(class="button")}}
</div>
<div class="control">
<div class="file has-name">
<label class="file-label">
{{ form.fichier(class="file-input") }}
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-file-import"></i>
</span>
<span class="file-label">
{{ form.fichier.label }}
</span>
</span>
{{ form.importer(class="button file-name") }}
</label>
</div>
{% for error in form.fichier.errors %}
<p class="help is-danger">{{error}}</p>
{% endfor %}
</div>
</div>
{% for error in form.charger.errors %}
<p class="help is-danger">{{error}}</p>
{% endfor %}
{% if form.referentiel.choices|length != 0 %}
<ul>
{% for referentiel in form.referentiel %}
<li>{{ referentiel }} {{ referentiel.data.code }} - {% if referentiel.data.nom == None or referentiel.data.titre == None %}/!\ Référentiel à compléter /!\{% else %}{{ referentiel.data.nom }}{{ referentiel.data.titre }}{% endif %}</li>
{% endfor %}
</ul>
<div class="control">
{{ form.supprimer(class="button is-danger") }}
{% for error in form.supprimer.errors %}
<p class="help is-danger">{{error}}</p>
{% endfor %}
</div>
{% endif %}
</div>
</form>
{% endblock %}