def get(self): page = self.get_argument('page' , 1) db = app.model.uc.user().find().limitPage( page , 20 ) pagination = db.getPagination() users = db.query() list = [] for user in users: user['roleNames'] = app.model.uc.user.roleNamesToStr( user['id'] ) user['roleIds'] = app.model.uc.user.roleIds( user['id'] ) list.append( user ) self.render("admin/user.html" , form = self.form() , list = list , roleForm = self.roleForm() , pagination = pagination )
def get(self): contentModel = app.model.bc.content() page = self.get_argument('page',1) db = contentModel.find().limitPage( page , 20)\ .where('[type] = %s' , 'page')\ .order('[id] DESC , [order] DESC')\ .fields('[id] , [title] , [created]') pagination = db.getPagination() contents = db.query() list = [] for v in contents: v['createdStr'] = time.strftime('%Y-%m-%d %H:%M' , time.localtime(v['created']) ) list.append( v ) self.render("admin/pages.html" , list = list , pagination = pagination )