On trie les entrées par ordre alphabétique "robuste"

This commit is contained in:
Jean-Marie Favreau 2024-11-13 00:36:14 +01:00
parent cf268523d8
commit 4936365488

View File

@ -5,6 +5,10 @@ from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.template.defaultfilters import date as _date from django.template.defaultfilters import date as _date
from django.db.models import CharField
from django.db.models.functions import Lower
CharField.register_lookup(Lower)
import logging import logging
@ -238,7 +242,7 @@ class CalendarList:
Q(other_versions__isnull=True) | Q(other_versions__isnull=True) |
Q(other_versions__representative=F('pk')) | Q(other_versions__representative=F('pk')) |
Q(other_versions__representative__isnull=True) Q(other_versions__representative__isnull=True)
).order_by("start_time", "title").prefetch_related("exact_location").prefetch_related("category").prefetch_related("other_versions") ).order_by("start_time", "title__unaccent__lower").prefetch_related("exact_location").prefetch_related("category").prefetch_related("other_versions")
firstdate = datetime.fromordinal(self.c_firstdate.toordinal()) firstdate = datetime.fromordinal(self.c_firstdate.toordinal())
if firstdate.tzinfo is None or firstdate.tzinfo.utcoffset(firstdate) is None: if firstdate.tzinfo is None or firstdate.tzinfo.utcoffset(firstdate) is None: