Commit 3d5c9614 by Oláh István Gergely

dashboard: fix base remove user template - adding username

parent a69982ab
...@@ -1009,6 +1009,14 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView): ...@@ -1009,6 +1009,14 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
slug_field = 'pk' slug_field = 'pk'
slug_url_kwarg = 'group_pk' slug_url_kwarg = 'group_pk'
def get_context_data(self, **kwargs):
context = super(GroupRemoveUserView, self).get_context_data(**kwargs)
try:
context['member'] = User.objects.get(pk=self.user_pk)
except User.DoesNotExist:
raise Http404()
return context
def get_success_url(self): def get_success_url(self):
next = self.request.POST.get('next') next = self.request.POST.get('next')
if next: if next:
...@@ -1016,6 +1024,10 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView): ...@@ -1016,6 +1024,10 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
else: else:
return reverse_lazy('dashboard.views.group-list') return reverse_lazy('dashboard.views.group-list')
def get(self, request, user_pk, *args, **kwargs):
self.user_pk = user_pk
return super(GroupRemoveUserView, self).get(request, *args, **kwargs)
def get_template_names(self): def get_template_names(self):
if self.request.is_ajax(): if self.request.is_ajax():
return ['dashboard/confirm/ajax-remove.html'] return ['dashboard/confirm/ajax-remove.html']
......
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