mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 11:04:20 +00:00
small fix in canViewList
This commit is contained in:
parent
ffbad7e2e7
commit
554929b4ec
@ -4,6 +4,7 @@ from django.shortcuts import render
|
|||||||
from django.http import HttpResponseForbidden, HttpResponseNotFound
|
from django.http import HttpResponseForbidden, HttpResponseNotFound
|
||||||
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist, ImproperlyConfigured
|
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist, ImproperlyConfigured
|
||||||
from django.views.generic.base import View
|
from django.views.generic.base import View
|
||||||
|
from django.db.models import Count
|
||||||
|
|
||||||
from core.models import Group
|
from core.models import Group
|
||||||
from core.views.forms import LoginForm
|
from core.views.forms import LoginForm
|
||||||
@ -110,7 +111,7 @@ class CanViewMixin(View):
|
|||||||
except: pass
|
except: pass
|
||||||
# If we get here, it's a ListView
|
# If we get here, it's a ListView
|
||||||
l_id = [o.id for o in self.get_queryset() if can_view(o, request.user)]
|
l_id = [o.id for o in self.get_queryset() if can_view(o, request.user)]
|
||||||
if not l_id:
|
if ((not l_id) and self.get_queryset().count() != 0):
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
self._get_queryset = self.get_queryset
|
self._get_queryset = self.get_queryset
|
||||||
def get_qs(self2):
|
def get_qs(self2):
|
||||||
|
Loading…
Reference in New Issue
Block a user