def reply_again(id): if not session.get("id"): return json.dumps(dict(error="请先登陆")) reply = Reply() reply.user_id = session.get("id") reply.reply_id = id reply.content = request.form.get("content") db_session.add(reply) db_session.commit() macro = get_template_attribute("reply_again.html", "repeat_reply") return json.dumps(dict(id=reply.id, content=macro(reply)))
def reply_again(id): user_id = session.get('id') content = request.form.get('content') if not user_id: return json.dumps(dict(error='请先登陆!')) if not content: return json.dumps(dict(error='请输入评论信息!')) reply = Reply() reply.user_id = user_id reply.content = content reply.reply_id = id db_session.add(reply) db_session.commit() macro_func = get_template_attribute('reply_recursion.html', 'reply_again') return json.dumps(dict(id=reply.id, content=macro_func(reply)))
def reply_again(id): if not session.get('id'): return jsonify(error='请先登陆!') content = request.form.get('content') if not content: return jsonify(error='请输入完整信息!') reply = Reply() reply.user_id = session.get('id') reply.reply_id = id reply.content = content db_session.add(reply) db_session.commit() macro = get_template_attribute('replyAgain.html', 'replyAgain') return jsonify(id=reply.id, html=macro(reply))
def reply_again(): if not session.get('id'): return jsonify(error='请先登陆') form = request.form if not form['content']: return jsonify(error='请填写信息') reply = Reply() reply.user_id = session.get('id') reply.content = form['content'] reply.reply_id = form['id'] db_session.add(reply) db_session.commit() macro = get_template_attribute('recurse.html', 'recurse') return jsonify(content=macro(reply))