1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Always query distinct objects

This commit is contained in:
Yohann D'ANELLO
2020-08-02 08:57:16 +02:00
parent 0ae61f3643
commit 2f018f8c9d
3 changed files with 8 additions and 4 deletions

View File

@ -20,7 +20,7 @@ class ProtectQuerysetMixin:
"""
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs)
return qs.filter(PermissionBackend.filter_queryset(self.request.user, qs.model, "view"))
return qs.filter(PermissionBackend.filter_queryset(self.request.user, qs.model, "view")).distinct()
def get_form(self, form_class=None):
form = super().get_form(form_class)