diff options
-rw-r--r-- | uploader/species/views.py | 22 | ||||
-rw-r--r-- | uploader/templates/species/view-species.html | 2 |
2 files changed, 22 insertions, 2 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." diff --git a/uploader/templates/species/view-species.html b/uploader/templates/species/view-species.html index 03141c8..15b2969 100644 --- a/uploader/templates/species/view-species.html +++ b/uploader/templates/species/view-species.html @@ -92,7 +92,7 @@ <dd>{{species.OrderId}}</dd> </dl> </div> - <a href="#" + <a href="{{url_for('species.edit_species', species_id=species.SpeciesId)}}" class="card-link" title="Edit the species' internal-use details.">Edit</a> </div> |