def delete_comment(request): """ 通过下面这样的链接来删除一个 todo /delete?id=1 """ id = int(request.query.get('id')) t = Comment.delete(id) return json_response(t.json())
def delete_comment(request): """ 通过下面这样的链接来删除一个 comment /delete?id=1 """ comment_id = int(request.query.get('id')) w = Comment.delete(comment_id) return json_response(w.json())
def delete_comment(request): """ 通过下面这样的链接来删除一个 todo /delete?id=1 """ comment_id = int(request.query.get('id')) c = Comment.delete(comment_id) cs = Comment.find_all(weibo_id=c.weibo_id) # 加载属于该微博的所有comment cs_list = [c.json() for c in cs] # 每一个对象转成dict return json_response(cs_list)
def delete_comment(request): """ 通过下面这样的链接来删除一个 comment 先不考虑权限认证的问题 /delete?id=1 """ comment_id = int(request.query.get('id')) t = Comment.delete(comment_id) return json_response(t.json()) pass
def delete_weibo(request): """ 通过下面这样的链接来删除一个 weibo及其comments /delete?id=1 """ weibo_id = int(request.query.get('id')) w = Weibo.delete(weibo_id) # 删除这个weibo cs = w.comments() for c in cs: cdel = Comment.delete(c.id) # 删除这个weibo关联的所有commnets return json_response(w.json())
def delete_comment(request): comment_id = int(request.query.get('id')) c = Comment.delete(comment_id) return json_response(c.json())
def comment_delete_weibo(request): cmt_id = int(request.query.get('id')) # print('cmt_id', cmt_id) cmt = Comment.delete(cmt_id) return json_response(cmt.json())