From d46ebeae3b383a90374081d709ba793234eff279 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Thu, 28 Nov 2024 23:29:47 +0100 Subject: [PATCH] =?UTF-8?q?Suppression=20des=20emoji=20sur=20les=20pages?= =?UTF-8?q?=20avec=20plusieurs=20=C3=A9v=C3=A9nements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #226 --- src/agenda_culturel/templates/agenda_culturel/page-month.html | 2 +- .../templates/agenda_culturel/page-upcoming.html | 2 +- src/agenda_culturel/templates/agenda_culturel/page-week.html | 2 +- src/agenda_culturel/templatetags/utils_extra.py | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/agenda_culturel/templates/agenda_culturel/page-month.html b/src/agenda_culturel/templates/agenda_culturel/page-month.html index b8e7703..993ee83 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-month.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-month.html @@ -107,7 +107,7 @@ {% if event.start_day == day.date and event.start_time %} {{ event.start_time }} {% endif %} - {{ event|picto_status }} {{ event.title }} {{ event|tw_badge }} + {{ event|picto_status }} {{ event.title|no_emoji }} {{ event|tw_badge }} {% endfor %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html b/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html index 3694735..c1a1fcc 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html @@ -99,7 +99,7 @@ {% if event.start_time %} {{ event.start_time }} {% endif %} - {{ event|picto_status }} {{ event.title }} {{ event|tw_badge }} + {{ event|picto_status }} {{ event.title|no_emoji }} {{ event|tw_badge }} {% endfor %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-week.html b/src/agenda_culturel/templates/agenda_culturel/page-week.html index faf783c..c078f32 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-week.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-week.html @@ -89,7 +89,7 @@ {% if event.start_day == day.date and event.start_time %} {{ event.start_time }} {% endif %} - {{ event|picto_status }} {{ event.title }} + {{ event|picto_status }} {{ event.title|no_emoji }} {{ event|tw_badge }}
diff --git a/src/agenda_culturel/templatetags/utils_extra.py b/src/agenda_culturel/templatetags/utils_extra.py index 105fa5c..a2df4f3 100644 --- a/src/agenda_culturel/templatetags/utils_extra.py +++ b/src/agenda_culturel/templatetags/utils_extra.py @@ -9,6 +9,7 @@ from django.urls import reverse_lazy from django.templatetags.static import static from string import ascii_uppercase as auc from django.utils.html import strip_tags +import emoji register = template.Library() @@ -137,3 +138,6 @@ def is_string(val): def html_vide(val): return len(strip_tags(val).replace(" ", "").strip()) == 0 +@register.filter +def no_emoji(text): + return emoji.replace_emoji(text, replace='')