Merge pull request #61 from ostcar/master
Forbid the deletion of the registered group
This commit is contained in:
commit
ab4c5791ad
@ -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>
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user