From 4ff158a8665400197fafb5fc98ba30c38d5f2844 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Wed, 27 May 2020 22:50:29 +0200 Subject: [PATCH] return to previous page after DeviceUpdateView --- devices/templates/devices/device_update.html | 6 ++++++ devices/views.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/devices/templates/devices/device_update.html b/devices/templates/devices/device_update.html index 8bbcc71..1096b50 100644 --- a/devices/templates/devices/device_update.html +++ b/devices/templates/devices/device_update.html @@ -16,5 +16,11 @@
+ + + {% endblock %} diff --git a/devices/views.py b/devices/views.py index 5210095..fc07b43 100644 --- a/devices/views.py +++ b/devices/views.py @@ -99,7 +99,7 @@ class DeviceUpdateView(LoginRequiredMixin, UpdateView): template_name = 'devices/device_update.html' def get_success_url(self): - return reverse('device', args=(self.object.pk,)) + return self.request.POST.get('previous_page') class DeviceDeleteView(LoginRequiredMixin, DeleteView):