aboutsummaryrefslogtreecommitdiff
path: root/uploader/species
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-09-04 18:47:42 -0500
committerFrederick Muriuki Muriithi2024-09-04 18:47:42 -0500
commit40dbb863ffb99721d4b736eb237ce94f15e61e48 (patch)
tree1c830397065589ba3e00ba91dace0375f05fedf7 /uploader/species
parent51817a59df3a0afc7222c071bf5bf20f770528dd (diff)
downloadgn-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.py22
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."