manager: fix ordering in user's roles table (#16474) #196

Merged
bdauvergne merged 1 commits from wip/16474-manage-tri-asciibetique-des-rol into main 2023-12-20 22:10:11 +01:00
Owner

A list was used instead of a queryset to allow django-tables2 to order
the table by the boolean value of the prefetched member attribute,
django-tables2 could not do it if the list was a queryset.
The side effect is that the sorting was done by Python instead of
PostgreSQL by Python does not respect unicode collation when doing so.

Member is now replaced by a subquery using the pair Exists/OuterRef and
sorting is now only done by PostgreSQL.

A list was used instead of a queryset to allow django-tables2 to order the table by the boolean value of the prefetched member attribute, django-tables2 could not do it if the list was a queryset. The side effect is that the sorting was done by Python instead of PostgreSQL by Python does not respect unicode collation when doing so. Member is now replaced by a subquery using the pair Exists/OuterRef and sorting is now only done by PostgreSQL.
Author
Owner

Voilà c'est trié correctement.

Voilà c'est trié correctement.
bdauvergne force-pushed wip/16474-manage-tri-asciibetique-des-rol from 334e313281 to 8536c17f84 2023-11-30 11:44:47 +01:00 Compare
pmarillonnet reviewed 2023-11-30 16:06:30 +01:00
@ -229,3 +229,3 @@
),
verbose_name=_('Member'),
order_by=('member', 'via', 'name'),
order_by=('member', '-name'),
Owner

Pourquoi est-ce qu’on passe à un ordre inverse sur name ici ?

Pourquoi est-ce qu’on passe à un ordre inverse sur `name` ici ?
Author
Owner

Erreur c'était sur member le - (pour que True arrive avabt False).

Erreur c'était sur member le - (pour que True arrive avabt False).
bdauvergne force-pushed wip/16474-manage-tri-asciibetique-des-rol from 8536c17f84 to f45440e035 2023-12-20 17:16:31 +01:00 Compare
bdauvergne requested review from pmarillonnet 2023-12-20 17:16:42 +01:00
pmarillonnet approved these changes 2023-12-20 17:21:42 +01:00
pmarillonnet left a comment
Owner

Ok.

Ok.
Author
Owner

Aussi le functools.lru_cache c'est parce que les classes dynamiques ne sont pas garbage collectées immédiatement (https://stackoverflow.com/questions/28523606/when-are-python-classes-and-class-attributes-garbage-collected) car il y a des cycles.

Aussi le functools.lru_cache c'est parce que les classes dynamiques ne sont pas garbage collectées immédiatement (https://stackoverflow.com/questions/28523606/when-are-python-classes-and-class-attributes-garbage-collected) car il y a des cycles.
bdauvergne merged commit f45440e035 into main 2023-12-20 22:10:11 +01:00
bdauvergne deleted branch wip/16474-manage-tri-asciibetique-des-rol 2023-12-20 22:10:11 +01:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: entrouvert/authentic#196
No description provided.