From fdbb76bca11ef769f7ae837ce386d94dd97692d6 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Wed, 3 Mar 2021 15:30:33 +0100 Subject: [PATCH] add working redirect after device add completes --- owrx/controllers/settings/__init__.py | 5 ++++- owrx/controllers/settings/sdr.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/owrx/controllers/settings/__init__.py b/owrx/controllers/settings/__init__.py index a7ff055..510a265 100644 --- a/owrx/controllers/settings/__init__.py +++ b/owrx/controllers/settings/__init__.py @@ -78,10 +78,13 @@ class SettingsFormController(AuthorizationMixin, WebpageController, metaclass=AB data = parse_qs(self.get_body().decode("utf-8"), keep_blank_values=True) return {k: v for i in self.getSections() for k, v in i.parse(data).items()} + def getSuccessfulRedirect(self): + return self.request.path + def processFormData(self): self.processData(self.parseFormData()) self.store() - self.send_redirect(self.request.path) + self.send_redirect(self.getSuccessfulRedirect()) def processData(self, data): config = self.getData() diff --git a/owrx/controllers/settings/sdr.py b/owrx/controllers/settings/sdr.py index 447552f..88ec33e 100644 --- a/owrx/controllers/settings/sdr.py +++ b/owrx/controllers/settings/sdr.py @@ -197,6 +197,9 @@ class NewSdrDeviceController(SettingsFormController): config["sdrs"] = sdrs super().store() + def getSuccessfulRedirect(self): + return "{}settings/sdr/{}".format(self.get_document_root(), self.stack["id"]) + class SdrProfileController(SdrFormController): def __init__(self, handler, request, options):