From 9fbfac7bdb71d861d167fb99cf0dfdbb1af10158 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Mon, 6 Apr 2020 11:43:17 +0200 Subject: [PATCH] distinct on field not supported by sqlite --- apps/activity/views.py | 2 +- apps/permission/backends.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/activity/views.py b/apps/activity/views.py index 51e2ebf5..34670d36 100644 --- a/apps/activity/views.py +++ b/apps/activity/views.py @@ -139,7 +139,7 @@ class ActivityEntryView(LoginRequiredMixin, TemplateView): | Q(name__regex=pattern) | Q(normalized_name__regex=Alias.normalize(pattern)))) \ .filter(PermissionBackend.filter_queryset(self.request.user, Alias, "view"))\ - .distinct("username")[:20] + .distinct()[:20] for note in note_qs: note.type = "Adhérent" note.activity = activity diff --git a/apps/permission/backends.py b/apps/permission/backends.py index 4fb7b577..04d93528 100644 --- a/apps/permission/backends.py +++ b/apps/permission/backends.py @@ -43,7 +43,7 @@ class PermissionBackend(ModelBackend): rolepermissions__role__membership__date_end__gte=datetime.date.today(), type=t, mask__rank__lte=get_current_session().get("permission_mask", 0), - ).distinct('club', 'pk',) + ).distinct() @staticmethod def permissions(user, model, type):