about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--uploader/genotypes/views.py22
-rw-r--r--uploader/templates/genotypes/index.html7
2 files changed, 26 insertions, 3 deletions
diff --git a/uploader/genotypes/views.py b/uploader/genotypes/views.py
index 1eaf0dd..648b38e 100644
--- a/uploader/genotypes/views.py
+++ b/uploader/genotypes/views.py
@@ -22,7 +22,7 @@ from uploader.authorisation import require_login
 from uploader.species.models import species_by_id
 from uploader.monadic_requests import make_either_error_handler
 from uploader.population.models import population_by_species_and_id
-from uploader.request_checks import with_population
+from uploader.request_checks import with_dataset, with_population
 
 
 from .models import (genotype_markers,
@@ -212,3 +212,23 @@ def create_dataset(species: dict, population: dict, **kwargs):# pylint: disable=
             make_either_error_handler(
                 "There was an error creating the genotype dataset."),
             __success__)
+
+
+@genotypesbp.route(
+    "/<int:species_id>/populations/<int:population_id>/genotypes/datasets/"
+    "<int:dataset_id>/add-records",
+    methods=["GET", "POST"])
+@require_login
+@with_population(species_redirect_uri="species.list_species",
+                 redirect_uri="species.populations.list_species_populations")
+@with_dataset(species_redirect_uri="species.list_species",
+              population_redirect_uri="species.populations.list_species_populations",
+              redirect_uri="species.populations.genotypes.index",
+              dataset_by_id=genotype_dataset)
+def add_genotype_records(species: dict, population: dict, dataset: dict, **kwargs):
+    """Add new Genotype records to the dataset."""
+    return render_template("genotypes/add-genotypes-records-csv.html",
+                           species=species,
+                           population=population,
+                           dataset=dataset,
+                           activelink="add-genotypes-records")
diff --git a/uploader/templates/genotypes/index.html b/uploader/templates/genotypes/index.html
index 6becd23..1c3483d 100644
--- a/uploader/templates/genotypes/index.html
+++ b/uploader/templates/genotypes/index.html
@@ -17,8 +17,11 @@
   <div class="row">
     <div class="col">
       <p>
-        <a href="#"
-           class="not-implemented btn btn-primary">
+        <a href="{{url_for(
+                 'species.populations.genotypes.add_genotype_records',
+                 species_id=species.SpeciesId, population_id=population.Id,
+                 dataset_id=dataset.Id)}}"
+           class="btn btn-primary">
           Add genotype records
         </a>
       </p>