def get(self, *args, **kwargs): con_id = self.get_argument('con_id', 'none') if con_id == 'none': con_data = NodeInfo.con_usage_info() else: con_data = NodeInfo.get_con_usage_modify(con_id) con_data_handled = DataManage.manage_con_usage_info(con_data) self.render("node/con_list.html", name=template_variables, con_data=con_data_handled)
def scope_of_data(self): ''' 返回每个数据范围要显示的这页的数据 :return: ''' start = (self.cur_page - 1) * self.data_num #比如当前也是5-1 * 每页显示数据8 那么数据就是32 end = self.cur_page * self.data_num #比如当前页是5 * 每页显示数据8 那么数据就是40 #show = self.total_data[start:end] #把起始位置和结束位置传到数据库取这一段的数据 show = NodeInfo.con_usage_info( start, end=self.data_num) #这里end-1是数据库limit的语法从0开始的 print(start, end, '---', len(show)) return show