mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
12 lines
355 B
Python
12 lines
355 B
Python
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from permission.backends import PermissionBackend
|
|
|
|
|
|
class ProtectQuerysetMixin:
|
|
def get_queryset(self, **kwargs):
|
|
qs = super().get_queryset(**kwargs)
|
|
|
|
return qs.filter(PermissionBackend.filter_queryset(self.request.user, qs.model, "view"))
|