on trie les tags sur les événements
This commit is contained in:
parent
283ffc4348
commit
c4bb86dab4
@ -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 = """
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
|
||||
<p>
|
||||
{% for tag in event.tags %}
|
||||
{% for tag in event.sorted_tags %}
|
||||
{{ tag | tag_button }}
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
@ -56,7 +56,7 @@
|
||||
{% endif %}
|
||||
<div class="infos">
|
||||
<p>
|
||||
{% for tag in event.tags %}
|
||||
{% for tag in event.sorted_tags %}
|
||||
<a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag|tw_highlight }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
@ -36,7 +36,7 @@
|
||||
{% if event.tags %}
|
||||
<p class="subentry-search">
|
||||
{% picto_from_name "tag" %}
|
||||
{% for tag in event.tags %}
|
||||
{% for tag in event.sorted_tags %}
|
||||
<a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag|tw_highlight }}</a>
|
||||
{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
|
@ -38,7 +38,7 @@
|
||||
{% if event.tags and event.tags|length > 0 %}
|
||||
<p>
|
||||
{% picto_from_name "tag" %}
|
||||
{% for tag in event.tags %}
|
||||
{% for tag in event.sorted_tags %}
|
||||
<a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag|tw_highlight }}</a>
|
||||
{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
|
||||
<p>
|
||||
{% for tag in event.tags %}
|
||||
{% for tag in event.sorted_tags %}
|
||||
{{ tag | tag_button }}
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
@ -65,7 +65,7 @@
|
||||
<div class="infos">
|
||||
|
||||
<p>
|
||||
{% for tag in event.tags %}
|
||||
{% for tag in event.sorted_tags %}
|
||||
<a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag|tw_highlight }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
Loading…
Reference in New Issue
Block a user