diff --git a/passbook/admin/views/users.py b/passbook/admin/views/users.py index 867895a2c..257ad955a 100644 --- a/passbook/admin/views/users.py +++ b/passbook/admin/views/users.py @@ -9,7 +9,11 @@ from django.shortcuts import redirect from django.urls import reverse, reverse_lazy from django.utils.translation import ugettext as _ from django.views.generic import DeleteView, DetailView, ListView, UpdateView -from guardian.mixins import PermissionListMixin, PermissionRequiredMixin +from guardian.mixins import ( + PermissionListMixin, + PermissionRequiredMixin, + get_anonymous_user, +) from passbook.admin.forms.users import UserForm from passbook.core.models import Nonce, User @@ -25,6 +29,9 @@ class UserListView(LoginRequiredMixin, PermissionListMixin, ListView): paginate_by = 40 template_name = "administration/user/list.html" + def get_queryset(self): + return super().get_queryset().exclude(pk=get_anonymous_user().pk) + class UserCreateView( SuccessMessageMixin,