From 50882ee56aaf721fc6d2acae8d8310871ab2d727 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 10 Oct 2022 09:08:12 +0200 Subject: [PATCH] 3924 redirect cancel to reffered --- ereuse_devicehub/inventory/views.py | 9 ++++++++- ereuse_devicehub/templates/inventory/new_transfer.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 63d9294f..fde885d7 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -756,6 +756,8 @@ class NewTransferView(GenericMixin): def dispatch_request(self, type_id, lot_id=None): self.form = self.form_class(lot_id=lot_id, type=type_id) self.get_context() + referrer = request.referrer or url_for('inventory.devicelist') + self.context.update({'referrer': referrer}) if self.form.validate_on_submit(): self.form.save() @@ -767,7 +769,12 @@ class NewTransferView(GenericMixin): next_url = url_for('inventory.lotdevicelist', lot_id=str(new_lot_id)) return flask.redirect(next_url) - self.context.update({'form': self.form, 'title': self.title}) + self.context.update( + { + 'form': self.form, + 'title': self.title, + } + ) return flask.render_template(self.template_name, **self.context) diff --git a/ereuse_devicehub/templates/inventory/new_transfer.html b/ereuse_devicehub/templates/inventory/new_transfer.html index f3776c41..428e10fe 100644 --- a/ereuse_devicehub/templates/inventory/new_transfer.html +++ b/ereuse_devicehub/templates/inventory/new_transfer.html @@ -55,7 +55,7 @@ {% endfor %}
- Cancel + Cancel