From d1be12653739c8612b4db7fa1d98b7ee1bc55f21 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 7 Nov 2025 17:32:27 +0100 Subject: [PATCH] Correction forms ChantDoc --- beesgospel/forms.py | 2 +- templates/membres/chant_edit.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/beesgospel/forms.py b/beesgospel/forms.py index 2a5161f..9a47efe 100644 --- a/beesgospel/forms.py +++ b/beesgospel/forms.py @@ -69,7 +69,7 @@ class ChantDocForm(BootstrapMixin, forms.ModelForm): def clean(self): data = super().clean() - if not data.get("fichier") and not data.get("lien"): + if not self.instance.pk and not data.get("fichier") and not data.get("lien"): raise forms.ValidationError("Vous devez indiquer un fichier ou un lien") elif data.get("fichier") and data.get("lien"): raise forms.ValidationError("Vous ne pouvez pas indiquer à la fois un fichier et un lien") diff --git a/templates/membres/chant_edit.html b/templates/membres/chant_edit.html index 58a1cea..38e559e 100644 --- a/templates/membres/chant_edit.html +++ b/templates/membres/chant_edit.html @@ -11,6 +11,7 @@ {% for subform in form.formset %}
+ {% for fld in subform.hidden_fields %}{{ fld }}{% endfor %} {% if subform.fichier %}{{ subform.fichier.as_field_group }} {% elif subform.instance.fichier %}
Fichier: {{ subform.instance.fichier }}