diff options
| author | Frederick Muriuki Muriithi | 2026-01-26 13:28:04 -0600 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2026-01-26 13:28:04 -0600 |
| commit | 79386454b1d87d5b4c1ace22e7b272a71fd205be (patch) | |
| tree | a133dedf4d37488cc00bf7410e98fc3707d36446 /uploader | |
| parent | 1908fc0a3dca8c547e5507851be250605b94c405 (diff) | |
| download | gn-uploader-79386454b1d87d5b4c1ace22e7b272a71fd205be.tar.gz | |
Outline deletion: Create scaffolding for idea.
Diffstat (limited to 'uploader')
| -rw-r--r-- | uploader/phenotypes/views.py | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index f7d8e55..5ade24d 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -1173,15 +1173,28 @@ def delete_phenotypes(# pylint: disable=[unused-argument] **kwargs ): """Delete the specified phenotype data.""" - if request.form.get("confirm", "").lower() == "confirm": - return f"Would delete! {request.form}" - with database_connection(app.config["SQL_URI"]) as conn: - xref_ids = tuple( - int(item) for item in set(request.form.getlist("xref_ids"))) - return render_template( - "phenotypes/confirm-delete-phenotypes.html", - species=species, - population=population, - dataset=dataset, - phenotypes=xref_ids) + form = request.form + xref_ids = tuple(int(item) for item in set(form.getlist("xref_ids"))) + + match form.get("action"): + case "cancel": + return redirect(url_for( + "species.populations.phenotypes.view_dataset", + species_id=species["SpeciesId"], + population_id=population["Id"], + dataset_id=dataset["Id"])) + case "delete": + # delete everything + # python3 -m scripts.phenotypes.delete_phenotypes <mariadburi> <authdburi> <speciesid> <populationid> + # + # delete selected phenotypes + # python3 -m scripts.phenotypes.delete_phenotypes <mariadburi> <authdburi> <speciesid> <populationid> --xref-ids-file=/path/to/file.txt + return "Would actually delete the data!" + case _: + return render_template( + "phenotypes/confirm-delete-phenotypes.html", + species=species, + population=population, + dataset=dataset, + phenotypes=xref_ids) |
