aboutsummaryrefslogtreecommitdiff
path: root/uploader/samples
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-02-18 16:24:14 -0600
committerFrederick Muriuki Muriithi2025-02-18 16:24:14 -0600
commit75add682a8d63a30e947b6bcd8d2e5dfee06c297 (patch)
tree45879792ca984fc5ef20933172742e48e4a40d97 /uploader/samples
parentc403183a504769af6b3aa25b5438e945efbc91ff (diff)
downloadgn-uploader-75add682a8d63a30e947b6bcd8d2e5dfee06c297.tar.gz
Use new searchable list tables with off-ramps for data creation.
Diffstat (limited to 'uploader/samples')
-rw-r--r--uploader/samples/views.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/uploader/samples/views.py b/uploader/samples/views.py
index ed79101..95a6f8c 100644
--- a/uploader/samples/views.py
+++ b/uploader/samples/views.py
@@ -40,8 +40,15 @@ def index():
if not bool(request.args.get("species_id")):
return render_template(
"samples/index.html",
- species=order_species_by_family(all_species(conn)),
+ species=all_species(conn),
activelink="samples")
+
+ species_id = request.args.get("species_id")
+ if species_id == "CREATE-SPECIES":
+ return redirect(url_for(
+ "species.create_species",
+ return_to="species.populations.samples.select_population"))
+
species = species_by_id(conn, request.args.get("species_id"))
if not bool(species):
flash("No such species!", "alert-danger")
@@ -63,13 +70,18 @@ def select_population(species_id: int):
if not bool(request.args.get("population_id")):
return render_template("samples/select-population.html",
species=species,
- populations=order_by_family(
- populations_by_species(
- conn,
- species_id),
- order_key="FamilyOrder"),
+ populations=populations_by_species(
+ conn,
+ species_id),
activelink="samples")
+ population_id = request.args["population_id"]
+ if population_id == "CREATE-POPULATION":
+ return redirect(url_for(
+ "species.populations.create_population",
+ species_id=species["SpeciesId"],
+ return_to="species.populations.samples.list_samples"))
+
population = population_by_id(conn, request.args.get("population_id"))
if not bool(population):
flash("Population not found!", "alert-danger")