From 4cde20ed17c17a66c6f9a59c70b94a4e68b9658c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 25 Nov 2015 10:04:37 +0100 Subject: [PATCH] backoffice: stay in backoffice after cancelling a submission (#9092) --- tests/test_backoffice_pages.py | 9 +++++++++ wcs/forms/root.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py index 0e98f95..3b8d9bf 100644 --- a/tests/test_backoffice_pages.py +++ b/tests/test_backoffice_pages.py @@ -682,6 +682,15 @@ def test_backoffice_submission(pub): assert data_class.count() == formdata_count + 1 + # test redirection on cancel + resp = app.get('/backoffice/submission/') + assert formdef.url_name in resp.body + + resp = resp.click(formdef.name) + resp.form['f1'] = 'test submission' + resp = resp.form.submit('cancel') + assert resp.location == 'http://example.net/backoffice/submission/' + def test_backoffice_submission_tracking_code(pub): user = create_user(pub) create_environment(pub) diff --git a/wcs/forms/root.py b/wcs/forms/root.py index 456b3d0..22f5578 100644 --- a/wcs/forms/root.py +++ b/wcs/forms/root.py @@ -602,6 +602,8 @@ class FormPage(Directory): return redirect(cancelurl) except KeyError: pass + if get_request().is_in_backoffice(): + return redirect(get_publisher().get_backoffice_url() + '/submission/') return redirect(get_publisher().get_root_url()) try: -- 2.6.2