Merge pull request #53 from ostcar/master

Ticket 399
This commit is contained in:
Oskar Hahn 2012-11-22 08:31:15 -08:00
commit a029a66a7c
2 changed files with 8 additions and 2 deletions

View File

@ -17,7 +17,7 @@
<tr class="{% cycle '' 'odd' %}">
<td><a href="{% model_url group 'view' %}">{{ group.name }}</a></td>
<td><a href="{% url user_group_edit group.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit group' %}"></a>
{% if group.name != 'Anonymous' %}
{% if group.name|lower != 'anonymous' %}
<a href="{% url user_group_delete group.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete group' %}"></a>
{% endif %}
</td>

View File

@ -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):
"""