def get(self): the_get = Get() cellphone = the_get.get_cellphone_number(self) if cellphone is None: cellphone = "" state = the_get.get_state(self) if state is None: state = "" page = the_get.get_page(self) data_count_per_page = the_get.get_data_count_per_page(self) page_count_per_page = the_get.get_page_count_per_page(self) offset = (page - 1) * data_count_per_page limit = data_count_per_page instance = User() if cellphone: query = instance.find_by_cellphone(cellphone) # instance.get_by_cellphone(cellphone) # query = instance.find_by_username() else: query = instance.get_all() try: if state == "": pass elif int(state): query = instance.get_valid(query) else: query = instance.get_invalid(query) except Exception as ex: pass users, count = instance.get_some_users(query, offset, limit) total_page = int(ceil(count / data_count_per_page)) pagination = Pagination(total_page, page, data_count_per_page, page_count_per_page) page_list, previous, next = pagination.get_page_list_of_this_page() # return self.render("backstage/management/user_list.html", return self.render( MANAGEMENT_USER_LIST_HTML, users=users, pages=page_list, previous=previous, next=next, page=page, cellphone_number=cellphone, state=state, detail_url=MANAGEMENT_USER_DETAIL_URL, delete_url=MANAGEMENT_USER_DELETE_URL, )
def get(self): the_get = Get() name = the_get.get_name(self) state = the_get.get_state(self) if name is None: name = "" if state is None: state = "" print("state", end=":") print(state) page = the_get.get_page(self) data_count_per_page = the_get.get_data_count_per_page(self) page_count_per_page = the_get.get_page_count_per_page(self) offset = (page - 1) * data_count_per_page limit = data_count_per_page instance = BodyType() query = instance.get_all() if name: query = instance.find_by_name(query, name) if state: if state == "1": print("state is 1") query = instance.get_valid(query) else: print("state is not 1") query = instance.get_invalid(query) query, count = instance.get_some(query, offset, limit) total_page = int(ceil(count / data_count_per_page)) pagination = Pagination(total_page, page, data_count_per_page, page_count_per_page) page_list, previous, next = pagination.get_page_list_of_this_page() return self.render(BASE_BODY_TYPE_LIST_HTML, body_types=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_BODY_TYPE_LIST_URL, detail_url=BASE_BODY_TYPE_DETAIL_URL, add_url=BASE_BODY_TYPE_ADD_URL, name=name, state=state)
def get(self): the_get = Get() instance = WorkDomain() name = the_get.get_name(self) state = the_get.get_state(self) if name is None: name = "" if state is None: state = "" page = the_get.get_page(self) data_count_per_page = the_get.get_data_count_per_page(self) page_count_per_page = the_get.get_page_count_per_page(self) offset = (page - 1) * data_count_per_page limit = data_count_per_page query = instance.get_all() if name: query = instance.find_by_name(query, name) if state: if state == "1": query = instance.get_valid(query) else: query = instance.get_invalid(query) query, count = instance.get_some(query, offset, limit) total_page = int(ceil(count / data_count_per_page)) pagination = Pagination(total_page, page, data_count_per_page, page_count_per_page) page_list, previous, next = pagination.get_page_list_of_this_page() return self.render(BASE_WORK_DOMAIN_LIST_HTML, work_domains=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_WORK_DOMAIN_LIST_URL, detail_url=BASE_WORK_DOMAIN_DETAIL_URL, add_url=BASE_WORK_DOMAIN_ADD_URL, name=name, state=state)