small fix in canViewList

This commit is contained in:
Pierre Brunet 2017-02-05 15:22:52 +01:00
parent fa1a4599b6
commit b3c2c79975
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ from django.shortcuts import render
from django.http import HttpResponseForbidden, HttpResponseNotFound
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist, ImproperlyConfigured
from django.views.generic.base import View
from django.db.models import Count
from core.models import Group
from core.views.forms import LoginForm
@ -110,7 +111,7 @@ class CanViewMixin(View):
except: pass
# If we get here, it's a ListView
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
self._get_queryset = self.get_queryset
def get_qs(self2):