def get(self, *args, **kwargs): # username = self.get_argument('user') username = tornado.escape.json_decode(self.current_user) usermod = user_mod.UserModel() userinfo = usermod.find_user(username) # print(userinfo) haveseen = [] if userinfo['haveseen'] != None: haveseen = userinfo['haveseen'].split(' ') haventseen = [] for i in range(1, len(alg_list.alg) + 1): if str(i) not in haveseen: haventseen.append(i) logmod = log_mod.LogModel() userloginfo = logmod.find_log_from_userid(userinfo['id']) # print(userinfo['id'], 'userloginfo', userloginfo) self.render( 'index.html', userinfo=userinfo, alglist=alg_list.alg, haveseen=haveseen, haventseen=haventseen, userloginfo=userloginfo, )
def get(self): # url : contain log id logid = self.get_argument('logid') username = tornado.escape.json_decode(self.current_user) logmod = log_mod.LogModel() loginfo = logmod.find_log_by_id(logid) self.render( 'logs_content.html', username=username, alg_list=alg_list.alg, loginfo=loginfo, )
def get(self): username = tornado.escape.json_decode(self.current_user) usermod = user_mod.UserModel() userinfo = usermod.find_user(username) logmod = log_mod.LogModel() userloginfo = logmod.find_log_from_userid(userinfo['id']) self.render( 'logs_manager.html', username=username, userloginfo=userloginfo, alg_list=alg_list.alg, )
def post(self): logtitle = self.get_argument('title') logcontent = self.get_argument('content') logalgid = self.get_argument('algid') username = tornado.escape.json_decode(self.current_user) print('-->', username) usermod = user_mod.UserModel() userinfo = usermod.find_user(username) userid = userinfo['id'] print('userid : ', userid) logmod = log_mod.LogModel() logcreate = logmod.create_log(userid, logalgid, logtitle, logcontent) print(logcreate)
def post(self): logid = self.get_argument('logid') content = self.get_argument('content') logmod = log_mod.LogModel() loginfo = logmod.update_log(logid, content) self.write("Failed !")
def post(self): delid = self.get_argument('delid')[3:] logmod = log_mod.LogModel() aftid = logmod.delete_log(delid) print('delid:', delid) self.write(str(aftid))