Commit b19ab633 by Kálmán Viktor

network: success messages for host actions

parent 5795d50c
...@@ -618,6 +618,11 @@ def remove_host_group(request, **kwargs): ...@@ -618,6 +618,11 @@ def remove_host_group(request, **kwargs):
# for post we actually remove the group from the host # for post we actually remove the group from the host
elif request.method == "POST": elif request.method == "POST":
host.groups.remove(group) host.groups.remove(group)
messages.success(request, _("Successfully removed %(host)s from "
"%(group)s group!" % {
'host': host,
'group': group
}))
return redirect(reverse_lazy('network.host', return redirect(reverse_lazy('network.host',
kwargs={'pk': kwargs['pk']})) kwargs={'pk': kwargs['pk']}))
...@@ -628,4 +633,9 @@ def add_host_group(request, **kwargs): ...@@ -628,4 +633,9 @@ def add_host_group(request, **kwargs):
host = Host.objects.get(pk=kwargs['pk']) host = Host.objects.get(pk=kwargs['pk'])
group = Group.objects.get(pk=group_pk) group = Group.objects.get(pk=group_pk)
host.groups.add(group) host.groups.add(group)
messages.success(request, _("Successfully added %(host)s to group "
"%(group)s!" % {
'host': host,
'group': group
}))
return redirect(reverse_lazy('network.host', kwargs=kwargs)) return redirect(reverse_lazy('network.host', kwargs=kwargs))
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