Added named cancel button that redirects to success_url.
This commit is contained in:
parent
147c0e8dfe
commit
8b01bbb2ce
@ -12,7 +12,8 @@
|
|||||||
<div class="LP-Form__Composition LP-Form__Composition--breakable">
|
<div class="LP-Form__Composition LP-Form__Composition--breakable">
|
||||||
<p class="LP-Paragraph">Are you sure you want to delete "{{place.name}}"?</p>
|
<p class="LP-Paragraph">Are you sure you want to delete "{{place.name}}"?</p>
|
||||||
<div class="LP-Form__Composition">
|
<div class="LP-Form__Composition">
|
||||||
<input type="submit" class="LP-Button" value="Löschen"/>
|
<input type="submit" class="LP-Button LP-Button--cancel" name="cancel" value="Cancel"/>
|
||||||
|
<input type="submit" class="LP-Button" name="Delete" value="Delete"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -98,6 +98,10 @@ class PlaceCreateView(View):
|
|||||||
class PlaceDeleteView(DeleteView):
|
class PlaceDeleteView(DeleteView):
|
||||||
template_name = 'place/place_delete.html'
|
template_name = 'place/place_delete.html'
|
||||||
model = Place
|
model = Place
|
||||||
|
success_url = reverse_lazy('place_list')
|
||||||
|
|
||||||
def get_success_url(self):
|
def post(self, request, *args, **kwargs):
|
||||||
return reverse_lazy('place_list')
|
if "cancel" in request.POST:
|
||||||
|
return redirect(self.success_url)
|
||||||
|
else:
|
||||||
|
return super(PlaceDeleteView, self).post(request, *args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user