From e168445497f51d944a89ccc796df6da5fdda7fa0 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Thu, 22 Nov 2012 17:29:49 +0100 Subject: [PATCH] fixed error, which allowed admins to delete the anonymous grou --- .../participant/templates/participant/group_overview.html | 2 +- openslides/participant/views.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/openslides/participant/templates/participant/group_overview.html b/openslides/participant/templates/participant/group_overview.html index a0f5186bb..8bcbf46c1 100644 --- a/openslides/participant/templates/participant/group_overview.html +++ b/openslides/participant/templates/participant/group_overview.html @@ -17,7 +17,7 @@ {{ group.name }} - {% if group.name != 'Anonymous' %} + {% if group.name|lower != 'anonymous' %} {% endif %} diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 5b1097295..b4be8b998 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -209,7 +209,7 @@ class UserDeleteView(DeleteView): if self.get_object() == self.request.user: messages.error(request, _("You can not delete yourself.")) else: - super(DeleteView, self).pre_redirect(request, *args, **kwargs) + super(UserDeleteView, self).pre_redirect(request, *args, **kwargs) class SetUserStatusView(RedirectView, SingleObjectMixin): """ @@ -442,6 +442,12 @@ class GroupDeleteView(DeleteView): model = Group url = 'user_group_overview' + def pre_redirect(self, request, *args, **kwargs): + if self.get_object().name.lower() == 'anonymous': + messages.error(request, _("You can not delete this Group.")) + else: + super(GroupDeleteView, self).pre_redirect(request, *args, **kwargs) + class Config(FormView): """