Пример #1
0
def reply(index,user_name):
    form = CommentForm()
    if form.validate_on_submit():
        comment = Comment(content=form.content.data)
        comment.user_id = g.user.id
        comment.article_id = index  #
        # comment.reply_type = 2
        comment.to_user = user_name
        db.session.add(comment)
        db.session.commit()
        flash('Submit reply successfully.')
        return redirect(url_for('detail', index=index))
    return render_template('reply.html', title='Reply', form=form)