Ajout modèle ChantDoc

This commit is contained in:
Claude Paroz 2025-10-19 19:43:37 +02:00
parent c7a08b3d3c
commit c37c52cb5d
16 changed files with 112 additions and 7 deletions

View file

@ -3,8 +3,19 @@
{% block content %}
<h2>Édition/ajout de chant</h2>
<form method="post">{% csrf_token %}
<form method="post" enctype="multipart/form-data">{% csrf_token %}
{{ form.as_div }}
{% if form.formset %}
<h4 class="mt-3">Fichiers joints à ce chant</h4>
{{ form.formset.management_form }}
{% for subform in form.formset %}
<div class="card text-bg-secondary mt-2">
<div class="card-body">
{{ subform }}
</div>
</div>
{% endfor %}
{% endif %}
<div class="mt-3"><button type="submit" class="btn btn-primary">Enregistrer</button></div>
</form>
{% endblock content %}

View file

@ -1,23 +1,31 @@
{% extends "base.html" %}
{% load bees_utils %}
{% block content %}
<h2>Liste des chants</h2>
<table class="table table-striped table-responsive table-chants">
<tr><th scope="col" class="numero"></th><th scope="col">Titre</th><th></th><th scope="col" class="boutons"></th></tr>
<table class="table table-striped table-bordered table-responsive table-chants">
<tr><th scope="col" class="numero"></th><th scope="col">Titre</th><th></th><th></th>
{% if perms.beesgospel.change_chant %}<th scope="col" class="boutons"></th>{% endif %}</tr>
{% for chant in object_list %}
<tr class="editable">
<td>{{ chant.numero }}</td>
<td>{{ chant.titre }}</td>
<td>{% for doc in chant.chantdoc_set.all %}
<a href="{{ doc.fichier.url }}">
<img src="{{ doc.fichier.path|icon_url }}" title="{{ doc.titre }}" data-bs-toggle="tooltip">
</a>{% endfor %}
</td>
<td>{{ chant.particularite }}</td>
<td class="text-nowrap">{% if perms.beesgospel.change_chant %}
{% if perms.beesgospel.change_chant %}
<td class="text-nowrap">
<a href="{% url 'chant-edit' chant.pk %}" class="edit-button">
<img src="{% static 'admin/img/icon-changelink.svg' %}">
</a>
<form method="post" class="d-inline" action="{% url 'chant-delete' chant.pk %}">{% csrf_token %}
<button type="submit" class="btn btn-link delete-button"><img src="{% static 'admin/img/icon-deletelink.svg' %}"></button>
</form>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</table>