Commit 0e9039cf by Oláh István Gergely

dashboard: fix GroupList

parent 656289ad
...@@ -981,16 +981,14 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView): ...@@ -981,16 +981,14 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
class GroupList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView): class GroupList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
template_name = "dashboard/group-list.html" template_name = "dashboard/group-list.html"
modul = Group
table_class = GroupListTable table_class = GroupListTable
table_pagination = False table_pagination = False
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
user = self.request.user
if self.request.is_ajax(): if self.request.is_ajax():
groups = []
if user.has_module_perms('auth'):
pks = [i[0] for i in GroupProfile.get_objects_with_level( pks = [i[0] for i in GroupProfile.get_objects_with_level(
'operator', user).values_list('pk')] 'operator', self.request.user).values_list('pk')]
groups = Group.objects.filter(groupprofile__in=pks) groups = Group.objects.filter(groupprofile__in=pks)
groups = [{ groups = [{
'url': reverse("dashboard.views.group-detail", 'url': reverse("dashboard.views.group-detail",
...@@ -1004,13 +1002,10 @@ class GroupList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView): ...@@ -1004,13 +1002,10 @@ class GroupList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
return super(GroupList, self).get(*args, **kwargs) return super(GroupList, self).get(*args, **kwargs)
def get_queryset(self): def get_queryset(self):
user = self.request.user
logger.debug('GroupList.get_queryset() called. User: %s', logger.debug('GroupList.get_queryset() called. User: %s',
unicode(self.request.user)) unicode(self.request.user))
groups = []
if user.has_module_perms('auth'):
pks = [i[0] for i in GroupProfile.get_objects_with_level( pks = [i[0] for i in GroupProfile.get_objects_with_level(
'operator', user).values_list('pk')] 'operator', self.request.user).values_list('pk')]
groups = Group.objects.filter(groupprofile__in=pks) groups = Group.objects.filter(groupprofile__in=pks)
s = self.request.GET.get("s") s = self.request.GET.get("s")
if s: if s:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment