Suppression des emoji sur les pages avec plusieurs événements

Fix #226
This commit is contained in:
Jean-Marie Favreau 2024-11-28 23:29:47 +01:00
parent 3be7d901c8
commit d46ebeae3b
4 changed files with 7 additions and 3 deletions

View File

@ -107,7 +107,7 @@
{% if event.start_day == day.date and event.start_time %}
{{ event.start_time }}
{% endif %}
<a href="{{ event.get_absolute_url }}">{{ event|picto_status }} {{ event.title }} {{ event|tw_badge }}</a>
<a href="{{ event.get_absolute_url }}">{{ event|picto_status }} {{ event.title|no_emoji }} {{ event|tw_badge }}</a>
</li>
{% endfor %}
</ul>

View File

@ -99,7 +99,7 @@
{% if event.start_time %}
{{ event.start_time }}
{% endif %}
{{ event|picto_status }} <a href="#event-{{ event.id }}">{{ event.title }}</a> {{ event|tw_badge }}
{{ event|picto_status }} <a href="#event-{{ event.id }}">{{ event.title|no_emoji }}</a> {{ event|tw_badge }}
</li>
{% endfor %}
</ul>

View File

@ -89,7 +89,7 @@
{% if event.start_day == day.date and event.start_time %}
{{ event.start_time }}
{% endif %}
{{ event|picto_status }} <a href="{{ event.get_absolute_url }}" data-target="event-{{ event.id }}" onClick="toggleModal(event)">{{ event.title }}</a>
{{ event|picto_status }} <a href="{{ event.get_absolute_url }}" data-target="event-{{ event.id }}" onClick="toggleModal(event)">{{ event.title|no_emoji }}</a>
{{ event|tw_badge }}
<dialog id="event-{{ event.id }}">
<article>

View File

@ -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("&nbsp;", "").strip()) == 0
@register.filter
def no_emoji(text):
return emoji.replace_emoji(text, replace='')