diff options
| -rw-r--r-- | uploader/genotypes/views.py | 19 | ||||
| -rw-r--r-- | uploader/static/js/files.js | 3 |
2 files changed, 17 insertions, 5 deletions
diff --git a/uploader/genotypes/views.py b/uploader/genotypes/views.py index 648b38e..e475986 100644 --- a/uploader/genotypes/views.py +++ b/uploader/genotypes/views.py @@ -227,8 +227,17 @@ def create_dataset(species: dict, population: dict, **kwargs):# pylint: disable= 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") + if request.method == "GET": + return render_template("genotypes/add-genotypes-records-csv.html", + species=species, + population=population, + dataset=dataset, + activelink="add-genotypes-records") + + if "application/json" in request.headers.get("Accept"): + return make_response( + jsonify({ + "message": ("Upload successful. Follow the 'redirect-to' URI " + "to continue") + }), + 200) diff --git a/uploader/static/js/files.js b/uploader/static/js/files.js index f6c9c97..7532df3 100644 --- a/uploader/static/js/files.js +++ b/uploader/static/js/files.js @@ -286,6 +286,9 @@ var makeFormSubmitter = function (form, processForm, num_files) { "url": form.attr("action"), "type": "POST", "data": processForm(form[0], uploaded_files),// `uploaded_files` changes with each file added -- check this and fix. + "beforeSend": function(xhr) { + xhr.setRequestHeader("Accept", "application/json"); + }, "processData": false, "contentType": false, "success": (data, textstatus, jqxhr) => { |
