def load_researcher_affiliations():
"""Preload organisation data."""
form = FileUploadForm()
if form.validate_on_submit():
filename = secure_filename(form.file_.data.filename)
try:
task = Task.load_from_csv(read_uploaded_file(form), filename=filename)
flash(f"Successfully loaded {task.record_count} rows.")
return redirect(url_for("affiliationrecord.index_view", task_id=task.id))
except (
ValueError,
ModelException,
) as ex:
flash(f"Failed to load affiliation record file: {ex}", "danger")
app.logger.exception("Failed to load affiliation records.")
return render_template("fileUpload.html", form=form, form_title="Researcher")
views.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录