diff --git a/app.py b/app.py index 525376b..77b2b1a 100644 --- a/app.py +++ b/app.py @@ -205,7 +205,8 @@ def create_app(config_object="config"): battery.device_id = None db.commit() flash(f"{battery.label} unassigned and marked available.", "success") - return redirect(url_for("dashboard")) + next_url = request.form.get("next", "") + return redirect(next_url if next_url.startswith("/") else url_for("dashboard")) # ------------------------------------------------------------------ # # Battery — retire diff --git a/templates/device_detail.html b/templates/device_detail.html index f7ebc1e..1405a30 100644 --- a/templates/device_detail.html +++ b/templates/device_detail.html @@ -95,6 +95,7 @@ function addInstallRow() {