Verified Commit 85093ec8 authored by Marco Marinello's avatar Marco Marinello
Browse files

Show a success message

parent 5f01e62d
# coding: utf-8
from django.core.urlresolvers import reverse, reverse_lazy
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.messages.views import SuccessMessageMixin
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import DeleteView
import hosts.models as hmodels
import problems.models as pmodels
......@@ -112,9 +113,10 @@ def reinstate_host(request, id):
return HttpResponseRedirect(reverse('host', args=[host.id,]))
class DropHost(UserMixin, DeleteView):
class DropHost(UserMixin, SuccessMessageMixin, DeleteView):
model = hmodels.Computer
template_name = "hosts/drop_host.html"
success_message = _("%(hostname)s has been successfully deleted.")
def get_success_url(self):
return reverse_lazy("school_detail", kwargs={"pk": self.object.school.pk})
......
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 to comment