def comment_add(request): user = current_user(request) form = request.form() comment = Comment(form) comment.user_id = user.id comment.save() return redirect('/weibo/index?user_id={}'.format(user.id))
def comment(): form = request.form u = current_user() c = Comment(form) print('request comment', c.comment) c.name = u.username if c.valid(): c.save() return redirect(url_for('.index'))
def comment_add(request): uname = current_user(request) user = User.find_by(username=uname) if user is None: return redirect('/login') form = request.form() c = Comment(form) c.user_id = user.id c.save() return redirect('/weibo')
def comment_add(request): uid = current_user_id(request) form = request.form() weibo_id = form.get('weibo_id', -1) new_form = { 'weibo_id': weibo_id, 'user_id': uid, } form.update(new_form) comment = Comment(form) Comment.add(comment) return redirect(f'/weibo/index?user_id={str(uid)}')
def comment_add(request): headers = { 'Content-Type': 'text/html', } uid = current_user(request) header = response_with_headers(headers) user = User.find(uid) # 创建微博 form = request.form() w = Comment(form) w.user_id = user.id w.save() return redirect('/weibo/index?user_id={}'.format(user.id))
def comment_add(): u = current_user() if u is not None: # log('comment_add', u.id, u.username) form = request.form c = Comment(form) c.user_id = u.id c.username = u.username c.weibo_id = int(form.get('weibo_id', -1)) if c.valid_add(): c.save() return redirect(url_for('.index', username=u.username)) else: abort(401)
def comment_add(user): form = request.form c = Comment(form) status, data, msg = c.save_comment(user) return api_response(status, data, msg)