Beispiel #1
0
def reply_again():
    if not session.get('id'):
        return jsonify(error='请先登陆!')

    content = request.form.get('content')
    if not content:
        return jsonify(error='请填写内容')

    reply = Reply()
    reply.content = content
    reply.user_id = session.get('id')
    reply.reply_parent_id = request.form.get('id')

    db_session.add(reply)
    db_session.commit()

    macro = get_template_attribute('recurse.html', 'recurse_reply')

    return jsonify(content=macro(reply))