def get(self): cid = self.get_argument('cid', None) cmtid = self.get_argument('cmtid', None) if cid: course = Course.get_course_by_cid(cid) self.render('updateCourse.html', course=course) if cmtid: comment = Comment.get_comment_by_cmtid(cmtid) self.render('updateComment.html', comment=comment)
def get(self): cid = self.get_argument('cid', None) if cid: res = Course.get_course_by_cid(int(cid)) res_list = res.get_all_comments() adict = {"all": []} for item in res_list: adict["all"].append({"cmtid": item.cmtid, "comment": item.comment, "like": item.like, "unlike": item.unlike, "author": item.author, "status": item.status}) json_str = json.dumps(adict, ensure_ascii=False) self.write(json_str) else: self.writer(0)