Don't allow to remove the registered group

This commit is contained in:
Oskar Hahn 2012-11-28 13:59:14 +01:00
parent e7c47395bb
commit 8306e7bf6e
2 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@
</li> </li>
{# delete group #} {# delete group #}
{% if group.name != 'Anonymous' %} {% if group.name|lower != 'anonymous' and group.name|lower != 'registered' %}
<li> <li>
<a href="{% model_url group 'delete' %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete group' %}</a> <a href="{% model_url group 'delete' %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete group' %}</a>
</li> </li>

View File

@ -441,7 +441,7 @@ class GroupDeleteView(DeleteView):
url = 'user_group_overview' url = 'user_group_overview'
def pre_redirect(self, request, *args, **kwargs): def pre_redirect(self, request, *args, **kwargs):
if self.get_object().name.lower() == 'anonymous': if self.get_object().name.lower() in ['anonymous', 'registered']:
messages.error(request, _("You can not delete this Group.")) messages.error(request, _("You can not delete this Group."))
else: else:
super(GroupDeleteView, self).pre_redirect(request, *args, **kwargs) super(GroupDeleteView, self).pre_redirect(request, *args, **kwargs)