Skip to content
Snippets Groups Projects
Commit ee12e2a4 authored by Yifan Su's avatar Yifan Su
Browse files

Update views.py

parent d4d75609
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ def add_comment(post_id):
if post:
comment_content = request.form.get('comment')
if comment_content and len(comment_content) >= 1:
new_comment = Comment(comment_content=comment_content, user_id=current_user.user_id, post_id=post_id)
new_comment = Comment(comment_content=comment_content, user_id=current_user.username, post_id=post_id)
db.session.add(new_comment)
db.session.commit()
return redirect(request.referrer or url_for('views.home'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment