le badge accorde au singulier ou pluriel suivant nb_drafts

This commit is contained in:
Jean-Marie Favreau 2023-12-12 20:02:24 +01:00
parent c93f97047f
commit 851102a86d

View File

@ -1,6 +1,7 @@
from django import template
from django.utils.safestring import mark_safe
from django.urls import reverse_lazy
from django.template.defaultfilters import pluralize
from agenda_culturel.models import Event
@ -43,7 +44,6 @@ def show_badges_events():
# TODO: seulement ceux dans le futur ?
nb_drafts = nb_draft_events()
if nb_drafts != 0:
return mark_safe('<a href="' + reverse_lazy("view_all_events") + '?status=draft" class="badge" data-tooltip="' + str(nb_drafts) + ' brouillons à valider">' + str(nb_drafts) + '</a>')
return mark_safe('<a href="' + reverse_lazy("view_all_events") + '?status=draft" class="badge" data-tooltip="' + str(nb_drafts) + ' brouillon' + pluralize(nb_drafts) + ' à valider">' + str(nb_drafts) + '</a>')
else:
return ""