From 313748f5ac782b3bdd998794ebb6886a6011427d Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Wed, 12 Aug 2020 12:38:50 +0200 Subject: [PATCH] Munch simpler solution using link-button. --- .../templates/place/place_delete.html | 16 +++++++++------- lostplaces/lostplaces_app/views.py | 8 ++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lostplaces/lostplaces_app/templates/place/place_delete.html b/lostplaces/lostplaces_app/templates/place/place_delete.html index ee3ef9a..2386abd 100644 --- a/lostplaces/lostplaces_app/templates/place/place_delete.html +++ b/lostplaces/lostplaces_app/templates/place/place_delete.html @@ -10,12 +10,14 @@ Place löschen {% csrf_token %}
-

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

-
- - -
-
- +

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

+
+ Cancel + + +
+ + {% endblock maincontent %} diff --git a/lostplaces/lostplaces_app/views.py b/lostplaces/lostplaces_app/views.py index 90486ac..ab0b67b 100644 --- a/lostplaces/lostplaces_app/views.py +++ b/lostplaces/lostplaces_app/views.py @@ -98,10 +98,6 @@ class PlaceCreateView(View): class PlaceDeleteView(DeleteView): template_name = 'place/place_delete.html' model = Place - success_url = 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) + def get_success_url(self): + return reverse_lazy('place_list')