From 90f935c4ed64306822727082b5699e0fe844f0ee Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 18 Feb 2025 09:31:32 -0600 Subject: Continue on to next step with newly created species. --- uploader/species/views.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'uploader/species') diff --git a/uploader/species/views.py b/uploader/species/views.py index a7e4d59..c671c21 100644 --- a/uploader/species/views.py +++ b/uploader/species/views.py @@ -62,6 +62,8 @@ def create_species(): if request.method == "GET": return render_template("species/create-species.html", families=species_families(conn), + return_to=( + request.args.get("return_to") or ""), activelink="create-species") error = False @@ -114,6 +116,10 @@ def create_species(): species = save_species( conn, common_name, scientific_name, family, taxon_id) flash("Species saved successfully!", "alert-success") + + return_to = request.form.get("return_to").strip() + if return_to: + return redirect(url_for(return_to, species_id=species["species_id"])) return redirect(url_for("species.view_species", species_id=species["species_id"])) -- cgit v1.2.3