diff --git a/lostplaces/lostplaces_app/templates/place/place_delete.html b/lostplaces/lostplaces_app/templates/place/place_delete.html index 246fa69..ee3ef9a 100644 --- a/lostplaces/lostplaces_app/templates/place/place_delete.html +++ b/lostplaces/lostplaces_app/templates/place/place_delete.html @@ -12,9 +12,10 @@

Are you sure you want to delete "{{place.name}}"?

- + +
-{% endblock maincontent %} \ No newline at end of file +{% endblock maincontent %} diff --git a/lostplaces/lostplaces_app/views.py b/lostplaces/lostplaces_app/views.py index ab0b67b..90486ac 100644 --- a/lostplaces/lostplaces_app/views.py +++ b/lostplaces/lostplaces_app/views.py @@ -98,6 +98,10 @@ class PlaceCreateView(View): class PlaceDeleteView(DeleteView): template_name = 'place/place_delete.html' model = Place + success_url = reverse_lazy('place_list') - def get_success_url(self): - return reverse_lazy('place_list') + def post(self, request, *args, **kwargs): + if "cancel" in request.POST: + return redirect(self.success_url) + else: + return super(PlaceDeleteView, self).post(request, *args, **kwargs)