diff options
author | Frederick Muriuki Muriithi | 2024-09-04 18:47:42 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-09-04 18:47:42 -0500 |
commit | 40dbb863ffb99721d4b736eb237ce94f15e61e48 (patch) | |
tree | 1c830397065589ba3e00ba91dace0375f05fedf7 /uploader/species | |
parent | 51817a59df3a0afc7222c071bf5bf20f770528dd (diff) | |
download | gn-uploader-40dbb863ffb99721d4b736eb237ce94f15e61e48.tar.gz |
Provide 'edit species' endpoint
* Verify new authorisation wrapper works as expected.
Diffstat (limited to 'uploader/species')
-rw-r--r-- | uploader/species/views.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/uploader/species/views.py b/uploader/species/views.py index 77406a1..5de5277 100644 --- a/uploader/species/views.py +++ b/uploader/species/views.py @@ -8,8 +8,8 @@ from flask import (flash, from uploader.population import popbp from uploader.ui import make_template_renderer -from uploader.authorisation import require_login from uploader.db_utils import database_connection +from uploader.authorisation import require_login, require_token from .models import all_species, save_species, species_by_id @@ -98,3 +98,23 @@ def create_species(): species = save_species(conn, common_name, scientific_name, taxon_id) flash("Species saved successfully!", "alert-success") return redirect(url_for("species.view_species", species_id=species["species_id"])) + + +@speciesbp.route("/<int:species_id>/edit") +@require_login +@require_token +#def edit_species(species_id: int): +def edit_species(token: dict, species_id: int): + """Edit a species' details. + + Parameters + ---------- + token: A JWT token used for authorisation. + species_id: An identifier for the species being edited. + """ + app.logger.debug("======================\n" + "Token: %s\n" + "SpeciesId: %s\n" + "======================", + token, species_id) + return "Would edit the species." |