diff --git a/idhub/models.py b/idhub/models.py index df9b76b..40b0b5d 100644 --- a/idhub/models.py +++ b/idhub/models.py @@ -634,7 +634,7 @@ class Service(models.Model): def get_roles(self): if self.rol.exists(): - return ", ".join([x.name for x in self.rol.all()]) + return ", ".join([x.name for x in self.rol.order_by("name")]) return _("None") def __str__(self): diff --git a/idhub/user/tables.py b/idhub/user/tables.py index d57a540..0cdb4fb 100644 --- a/idhub/user/tables.py +++ b/idhub/user/tables.py @@ -69,7 +69,14 @@ class RolesTable(tables.Table): def order_description(self, queryset, is_descending): queryset = queryset.order_by( - ("-" if is_descending else "") + "service__rol__description" + ("-" if is_descending else "") + "service__description" + ) + + return (queryset, True) + + def order_service(self, queryset, is_descending): + queryset = queryset.order_by( + ("-" if is_descending else "") + "service__domain" ) return (queryset, True)