From f6096e430e2bb914225823a1953c109bad89d755 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 12 Sep 2024 12:57:50 -0500 Subject: Save the updated species details. --- uploader/species/views.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'uploader/species/views.py') diff --git a/uploader/species/views.py b/uploader/species/views.py index f39ca98..55b0dd3 100644 --- a/uploader/species/views.py +++ b/uploader/species/views.py @@ -14,7 +14,11 @@ from uploader.db_utils import database_connection from uploader.oauth2.client import oauth2_get, oauth2_post from uploader.authorisation import require_login, require_token -from .models import all_species, save_species, species_by_id, species_families +from .models import (all_species, + save_species, + species_by_id, + update_species, + species_families) speciesbp = Blueprint("species", __name__) @@ -177,9 +181,14 @@ def edit_species_extra(token: dict, species_id: int):# pylint: disable=[unused-a ).either(__failure__, lambda res: res) if bool(species) and request.method == "POST": - flash("We would have edited the species, but the feature is not " - "currently implemented …", - "alert-danger") + update_species(conn, + species_id, + request.form["species_name"], + request.form["species_fullname"], + request.form["species_family"], + int(request.form["species_familyorderid"]), + int(request.form["species_orderid"])) + flash("Updated species successfully.", "alert-success") return redirect(url_for("species.edit_species_extra", species_id=species_id)) -- cgit v1.2.3