def post(self): BaseHandler.initialize(self) content = self.get_argument("content", default="") info_path = os.path.join(self.get_template_path(), 'aboutme.md') with open(info_path, 'w') as f: f.write(content.encode('utf8')) self.redirect('/admin/aboutus')
def get(self): BaseHandler.initialize(self) self.title = "Edit About Us" info_path = os.path.join(self.get_template_path(), 'aboutme.md') aboutcontent = open(info_path).read().decode('utf8') self.render("admin/about.html", aboutcontent = aboutcontent)
def post(self): BaseHandler.initialize(self) user_id = self.get_argument('user_id') role = self.get_argument('roleselect') users = db.user user_one = users.update_one({'user_id': user_id},{"$set": {"role": int(role)}}) self.write("done")
def get(self): BaseHandler.initialize(self) targetpage = int(self.get_argument('page',default='1')) keyword = self.get_argument('keyword',default='') papers = db.paper keywords = '/'+keyword+'/' paperList = papers.find({"$or":[{"title": {"$regex":keyword}},{"content": {"$regex":keyword}}]}).sort("reviseTime") paper, self.pagination = generatePagination('/search?keyword=' + keyword + '&page=', paperList, targetpage) self.thisquery = "搜索:" + keyword.encode('utf8') self.title = "搜索:" + keyword.encode('utf8') self.render("main/main.html", paper = paper)
def post(self): BaseHandler.initialize(self) user_id = self.get_argument('user_id') auth = self.get_argument('authselect') print auth if auth == 'True': auth = True else: auth = False users = db.user user_one = users.update_one({'user_id': user_id},{"$set": {"authenication": auth}}) self.write("done")
def get(self): BaseHandler.initialize(self) self.title = "Dashboard | " + self.signeduser users = db.user userList = users.find({}).sort('username') self.render("admin/index.html", userList = userList)