Add form and route to delete pre_reviews

This commit is contained in:
mike cullerton 2022-06-17 13:11:56 -04:00
parent adcc41de7e
commit 0fbbfcf898
2 changed files with 27 additions and 0 deletions

View File

@ -491,3 +491,13 @@ def edit_pre_review(study_id):
pre_reviews=pre_reviews
)
@app.route('/delete_pre_review/<pre_review_id>', methods=['POST'])
def delete_pre_review(pre_review_id):
model = session.query(PreReview).filter(PreReview.PROT_EVENT_ID == pre_review_id).first()
study_id = model.SS_STUDY_ID
session.delete(model)
session.commit()
redirect_url = url_for("edit_pre_review", study_id=study_id)
return redirect(redirect_url)

View File

@ -24,6 +24,23 @@
</form>
{% endif %}
{% if 'Edit Pre Review' in title %}
<div>
<div>Pre Reviews</div>
<div>
{% for review in pre_reviews %}
<div>
<p>Date: {{ review.DATEENTERED }}</p>
<p>&nbsp; &nbsp;Comments: {{ review.COMMENTS }}</p>
<form action="{{ review.form_action }}" method="post">
<input type=submit value=Delete label="Delete">
</form>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<form action="{{ action }}" method="post">
{{ form.csrf_token() }}