fix referrer path for redirect pages

This commit is contained in:
Cayo Puigdefabregas 2022-01-26 11:48:37 +01:00
parent 6fca974f04
commit 0018034fcd
1 changed files with 4 additions and 3 deletions

View File

@ -61,7 +61,8 @@ class LotDeviceAddView(View):
if form.validate_on_submit():
form.save()
return flask.redirect(request.referrer)
next_url = request.referrer or url_for('inventory.devices.devicelist')
return flask.redirect(next_url)
class LotDeviceDeleteView(View):
@ -74,8 +75,8 @@ class LotDeviceDeleteView(View):
if form.validate_on_submit():
form.remove()
# TODO @cayop It's possible this redirect not work in production
return flask.redirect(request.referrer)
next_url = request.referrer or url_for('inventory.devices.devicelist')
return flask.redirect(next_url)
class LotCreateView(View):