def comment_add(id): post = Posts.query.get(id) #Add error check here if request.method == 'POST': comment = Comments(id, request.form['author_name'], request.form['author_email'], 0, request.remote_addr, request.form['content'], 0, 0, request.headers['User-Agent'], 0, 0) comment_add=comment.add(comment) if not comment_add: flash("Add was successful") else: message = comment_add flash(message) return redirect(url_for('single_post', id=post.id, slug=post.slug))
def comment_add(id): post = Posts.query.get(id) #Add error check here if request.method == 'POST': comment = Comments(id, request.form['author_name'], request.form['author_email'], 0, request.remote_addr, request.form['content'], 0, 0, request.headers['User-Agent'], 0, 0) comment_add = comment.add(comment) if not comment_add: flash("Add was successful") else: message = comment_add flash(message) return redirect(url_for('single_post', id=post.id, slug=post.slug))