aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--apioforum/templates/view_thread.html2
-rw-r--r--apioforum/thread.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/apioforum/templates/view_thread.html b/apioforum/templates/view_thread.html
index 855f792..d45b36b 100644
--- a/apioforum/templates/view_thread.html
+++ b/apioforum/templates/view_thread.html
@@ -45,7 +45,7 @@
{% for opt in poll.options %}
<br>
<input type="radio" id="option_{{opt.option_idx}}" name="poll" value="{{opt.option_idx}}">
- <label for="option_{{opt.option_idx}}">#{{opt.option_idx}} - {{opt.text}}</label>
+ <label for="option_{{opt.option_idx}}">submit a vote for #{{opt.option_idx}} - {{opt.text}}</label>
{% endfor %}
</fieldset>
{% endif %}
diff --git a/apioforum/thread.py b/apioforum/thread.py
index 3dbc32d..3e03a67 100644
--- a/apioforum/thread.py
+++ b/apioforum/thread.py
@@ -46,6 +46,7 @@ def create_post(thread_id):
db = get_db()
content = request.form['content']
thread = db.execute("SELECT * FROM threads WHERE id = ?;",(thread_id,)).fetchone()
+ print(request.form.get('poll'))
if len(content.strip()) == 0:
flash("you cannot post an empty message")
elif not thread:
@@ -63,7 +64,8 @@ def create_post(thread_id):
)
db.commit()
flash("post posted postfully")
- return redirect(post_jump(thread_id, post_id))
+ return redirect(post_jump(thread_id, post_id))
+ return redirect(url_for('thread.view_thread',thread_id=thread_id))
@bp.route("/delete_post/<int:post_id>", methods=["GET","POST"])
def delete_post(post_id):