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")
|
verbose_name_plural = _("Events")
|
||||||
permissions = [("set_duplicated_event", "Can set an event as duplicated")]
|
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):
|
def get_all_tags(sort=True):
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
raw_query = """
|
raw_query = """
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% for tag in event.tags %}
|
{% for tag in event.sorted_tags %}
|
||||||
{{ tag | tag_button }}
|
{{ tag | tag_button }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="infos">
|
<div class="infos">
|
||||||
<p>
|
<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>
|
<a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag|tw_highlight }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
{% if event.tags %}
|
{% if event.tags %}
|
||||||
<p class="subentry-search">
|
<p class="subentry-search">
|
||||||
{% picto_from_name "tag" %}
|
{% 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>
|
<a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag|tw_highlight }}</a>
|
||||||
{% if not forloop.last %}, {% endif %}
|
{% if not forloop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
{% if event.tags and event.tags|length > 0 %}
|
{% if event.tags and event.tags|length > 0 %}
|
||||||
<p>
|
<p>
|
||||||
{% picto_from_name "tag" %}
|
{% 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>
|
<a href="{% url 'view_tag' tag|prepare_tag %}">{{ tag|tw_highlight }}</a>
|
||||||
{% if not forloop.last %}, {% endif %}
|
{% if not forloop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% for tag in event.tags %}
|
{% for tag in event.sorted_tags %}
|
||||||
{{ tag | tag_button }}
|
{{ tag | tag_button }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
<div class="infos">
|
<div class="infos">
|
||||||
|
|
||||||
<p>
|
<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>
|
<a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag|tw_highlight }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user