Commit bee83c92 by Oláh István Gergely

dashboard: separate user remove and acl member remove views

parent 8763f0bd
...@@ -986,7 +986,7 @@ class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView): ...@@ -986,7 +986,7 @@ class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
return reverse_lazy('dashboard.index') return reverse_lazy('dashboard.index')
class GroupAclRemoveView(LoginRequiredMixin, DeleteView): class GroupUserRemoveView(LoginRequiredMixin, DeleteView):
model = Group model = Group
slug_field = 'pk' slug_field = 'pk'
slug_url_kwarg = 'group_pk' slug_url_kwarg = 'group_pk'
...@@ -1005,13 +1005,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView): ...@@ -1005,13 +1005,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView):
return ['dashboard/confirm/base-remove.html'] return ['dashboard/confirm/base-remove.html']
def remove_user(self, userpk): def remove_user(self, userpk):
container = self.get_object().profile container = self.get_object()
container.set_level(User.objects.get(pk=userpk), None) container.set_level(User.objects.get(pk=userpk), None)
def get_success_message(self):
return _("Member successfully removed from group!")
def delete(self, request, *args, **kwargs): def delete(self, request, *args, **kwargs):
self.remove_user(kwargs["user_pk"]) self.remove_user(kwargs["user_pk"])
success_url = self.get_success_url() success_url = self.get_success_url()
success_message = _("Acl member successfully removed from group!") success_message = self.get_success_message()
if request.is_ajax(): if request.is_ajax():
return HttpResponse( return HttpResponse(
...@@ -1023,6 +1026,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView): ...@@ -1023,6 +1026,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView):
return HttpResponseRedirect(success_url) return HttpResponseRedirect(success_url)
class GroupAclRemoveView(GroupUserRemoveView):
def remove_user(self, userpk):
container = self.get_object().profile
container.set_level(User.objects.get(pk=userpk), None)
def get_success_message(self):
return _("Acl member successfully removed from group!")
class GroupDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView): class GroupDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
"""This stuff deletes the group. """This stuff deletes the group.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment