diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 04f2bff..49c1ee8 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -689,6 +689,14 @@ class Event(models.Model): verbose_name_plural = _("Events") permissions = [("set_duplicated_event", "Can set an event as duplicated")] + def sorted_tags(self): + if self.tags is None: + return [] + else: + result = self.tags + result.sort(key=lambda x: emoji.demojize(remove_accents(x.lower()), delimiters=('000', ''))) + return result + def get_all_tags(sort=True): cursor = connection.cursor() raw_query = """ diff --git a/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html b/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html index dd864cd..f477b8a 100644 --- a/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html @@ -55,7 +55,7 @@

- {% for tag in event.tags %} + {% for tag in event.sorted_tags %} {{ tag | tag_button }} {% endfor %}

diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html index 1d3a7a5..7511d29 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html @@ -56,7 +56,7 @@ {% endif %}

- {% for tag in event.tags %} + {% for tag in event.sorted_tags %} {{ tag|tw_highlight }} {% endfor %}

diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html index c9e569b..b5b6f7f 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html @@ -36,7 +36,7 @@ {% if event.tags %}

{% picto_from_name "tag" %} - {% for tag in event.tags %} + {% for tag in event.sorted_tags %} {{ tag|tw_highlight }} {% if not forloop.last %}, {% endif %} {% endfor %} diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html index b8fbcc7..51dfbf2 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html @@ -28,7 +28,7 @@

- {% for tag in event.tags %} + {% for tag in event.sorted_tags %} {{ tag | tag_button }} {% endfor %}

diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html index 18f04e6..f799ad9 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html @@ -65,7 +65,7 @@

- {% for tag in event.tags %} + {% for tag in event.sorted_tags %} {{ tag|tw_highlight }} {% endfor %}