def get(self): the_get = Get() instance = SensitiveBackstage() query = instance.get_all() name = the_get.get_name(self) if name: query = instance.find_by_name(query, name) 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, 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_SENSITIVE_BACKSTAGE_LIST_HTML, sensitive_list=query, pages=page_list, previous=previous, next=next, page=page, name=name, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_SENSITIVE_BACKSTAGE_LIST_URL, detail_url=BASE_SENSITIVE_BACKSTAGE_DETAIL_URL, add_url=BASE_SENSITIVE_BACKSTAGE_ADD_URL, delete_url=BASE_SENSITIVE_BACKSTAGE_DELETE_URL, )
def get(self): the_get = Get() instance = MatchLabel() 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_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_MATCH_LABEL_LIST_HTML, labels=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_MATCH_LABEL_LIST_URL, detail_url=BASE_MATCH_LABEL_DETAIL_URL, add_url=BASE_MATCH_LABEL_ADD_URL, )
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 = Hint() page = the_get.get_page(self) submit = the_get.get_submit(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) parent_id = the_get.get_id(self) if not parent_id: parent_id = 0 name = the_get.get_name(self) OHHOLog.print_log(submit) if submit: query = instance.get_all() elif not parent_id: query = instance.get_by_parent_id(None) else: query = instance.get_by_parent_id(parent_id) offset = (page - 1) * data_count_per_page limit = data_count_per_page if name is not None: query = instance.find_by_name(query, name) else: name = "" 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_HINT_BACKSTAGE_LIST_HTML, hints=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_HINT_BACKSTAGE_LIST_URL, detail_url=BASE_HINT_BACKSTAGE_DETAIL_URL, add_url=BASE_HINT_BACKSTAGE_ADD_URL, delete_url=BASE_HINT_BACKSTAGE_DELETE_URL, name=name, parent_id=parent_id, )
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)
def get(self): the_get = Get() identity_id = the_get.get_device_identity_id(self) if identity_id is None: identity_id = "" mac_address = the_get.get_device_mac_address(self) if mac_address is None: mac_address = "" 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 = Device() query = instance.get_all_device() if identity_id: instance.set_identity(identity_id) query = instance.find_by_identity(query) if mac_address: instance.set_mac_address(mac_address) query = instance.find_by_mac_address(query) devices, count = instance.get_some_devices(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/device_list.html", return self.render( MANAGEMENT_DEVICE_LIST_HTML, devices=devices, pages=page_list, previous=previous, next=next, page=page, identity_id=identity_id, mac_address=mac_address, detail_url=MANAGEMENT_DEVICE_DETAIL_URL, delete_url=MANAGEMENT_DEVICE_DELETE_URL, )
def get(self): the_get = Get() instance = Watchword() first = the_get.get_first(self) second = the_get.get_second(self) if first is None: first = "" if second is None: second = "" print("first", end=":") print(first) 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 first: query = instance.find_by_first(query, first) if second: query = instance.find_by_second(query, second) 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_WATCHWORD_LIST_HTML, watchwords=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_WATCHWORD_LIST_URL, detail_url=BASE_WATCHWORD_DETAIL_URL, add_url=BASE_WATCHWORD_ADD_URL, first=first, second=second)
def get(self): the_get = Get() instance = OHHOPermission() name = the_get.get_name(self) if name is None: name = "" 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.group.get_all() if name: query = instance.group.get_by_name(query, name) query, count = instance.group.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( PERMISSION_GROUP_BACKSTAGE_LIST_HTML, groups=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_PERMISSION_HOME_URL, list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL, detail_url=PERMISSION_GROUP_BACKSTAGE_DETAIL_URL, add_url=PERMISSION_GROUP_BACKSTAGE_ADD_URL, delete_url=PERMISSION_GROUP_BACKSTAGE_DELETE_URL, add_group_staff_relation_url= PERMISSION_GROUP_STAFF_RELATION_ADD_URL, group_page_relation_list_url= PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_URL, name=name, )
def get(self): the_get = Get() cellphone_manufacturer = the_get.get_cellphone_manufacturer(self) if cellphone_manufacturer is None: cellphone_manufacturer = "" platform_type = the_get.get_cellphone_platform_type(self) if platform_type is None: platform_type = "" 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 cellphone = Cellphone() query = cellphone.get_all_cellphone() if cellphone_manufacturer: query = cellphone.find_by_manufacturer(query, cellphone_manufacturer) if platform_type: query = cellphone.find_by_platform(query, platform_type) cellphones, count = cellphone.get_some_cellphones(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/cellphone_list.html", return self.render(MANAGEMENT_CELLPHONE_LIST_HTML, cellphones=cellphones, pages=page_list, previous=previous, next=next, page=page, cellphone_manufacturer=cellphone_manufacturer, platform_type=platform_type, detail_url=MANAGEMENT_CELLPHONE_DETAIL_URL, delete_url=MANAGEMENT_CELLPHONE_DELETE_URL)
def get(self): the_get = Get() instance = MatchCondition() sex = the_get.get_user_extension_sex(self) nickname = the_get.get_user_extension_nickname(self) if sex is None: sex = "" if nickname is None: nickname = "" 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.find(sex, nickname) 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_MATCH_CONDITION_LIST_HTML, match_conditions=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_MATCH_CONDITION_LIST_URL, detail_url=BASE_MATCH_CONDITION_DETAIL_URL, add_url=BASE_MATCH_CONDITION_ADD_URL, sex=sex, nickname=nickname, )
def get(self): the_get = Get() instance = UserDisplayConfiguration() drink = Drink() drinks = drink.get_all() distance = the_get.get_distance(self) if distance is None: distance = "" 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 distance: query = instance.find_by_distance(query, distance) 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_USER_DISPLAY_CONFIG_LIST_HTML, userConfigs=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_USER_DISPLAY_CONFIG_LIST_URL, detail_url=BASE_USER_DISPLAY_CONFIG_DETAIL_URL, add_url=BASE_USER_DISPLAY_CONFIG_ADD_URL, distance=distance, )
def get(self): the_get = Get() instance = CountryCode() country_name = the_get.get_name(self) if country_name is None or not country_name: country_name = "" 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 country_name: query = instance.get_by_country_name(country_name) 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_COUNTRY_CODE_BACKSTAGE_LIST_HTML, country_codes=query, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_BASE_HOME_URL, list_url=BASE_COUNTRY_CODE_BACKSTAGE_LIST_URL, detail_url=BASE_COUNTRY_CODE_BACKSTAGE_DETAIL_URL, add_url=BASE_COUNTRY_CODE_BACKSTAGE_ADD_URL, delete_url=BASE_COUNTRY_CODE_BACKSTAGE_DELETE_URL, country_name=country_name, )
def get(self): the_get = Get() cellphone_instance = Cellphone() relation_instance = UserAndCellphoneRelation() user_instance = User() users_query = user_instance.get_all() users_query = user_instance.get_valid(users_query) cellphones_query = cellphone_instance.get_all_cellphone() cellphone_key = the_get.get_cellphone_key(self) if cellphone_key is None: cellphone_key = "" username = the_get.get_username(self) if username is None: username = "" 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 = relation_instance.get_all() if cellphone_key: cellphone_query = cellphone_instance.get_all_cellphone() cellphone_query = cellphone_instance.find_by_key( cellphone_query, cellphone_key) cellphone_id_list = list() if not cellphone_instance.cellphone.is_empty(cellphone_query): cellphone_id_list = [ cellphone.id for cellphone in cellphone_query ] query = relation_instance.find_by_cellphone( query, cellphone_id_list) if username: user_query = user_instance.find_by_username(username) user_id_list = list() if not user_instance.user.is_empty(user_query): user_id_list = [user.id for user in user_query] query = relation_instance.find_by_user(query, user_id_list) query, count = relation_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() relations = list() for q in query: temp = dict() temp["id"] = q.id temp["state"] = q.state user = user_instance.get_by_id(q.user_id) temp["username"] = user.username if user else "" temp["user_id"] = user.id if user else "" cellphone = cellphone_instance.get_by_id(q.cellphone_id) temp["key"] = cellphone.key if cellphone else "" temp["cellphone_id"] = cellphone.id if cellphone else "" relations.append(temp) return self.render(USER_AND_CELLPHONE_LIST_HTML, relations=relations, pages=page_list, previous=previous, next=next, page=page, list_url=USER_AND_CELLPHONE_LIST_URL, detail_url=USER_AND_CELLPHONE_DETAIL_URL, add_url=USER_AND_CELLPHONE_ADD_URL, delete_url=USER_AND_CELLPHONE_DELETE_URL, username=username, cellphone_key=cellphone_key, users_query=users_query, cellphones_query=cellphones_query)
def get(self): the_get = Get() instance = OHHOPermission() group_id = the_get.get_id(self) 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.group_and_page.get_query() group_name = "" if group_id: query = instance.group_and_page.get_by_group_id(query, group_id) group = instance.group.get_by_id(group_id) if group: group_name = group.name query, count = instance.group_and_page.get_some(query, offset, limit) # query = query # count = instance.page_permission.get_count(query) 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() group_permissions = list() if query: for q in query: temp = dict() page_permission = instance.page_permission.get_by_id( q.page_permission_id) if page_permission: temp["group_id"] = group_id temp["page_permission_id"] = q.page_permission_id page = instance.page.get_by_id(page_permission.page_id) if page: temp["page_description"] = page.description temp["page_name"] = page.name temp["insert"] = page_permission.insert temp["update"] = page_permission.update temp["select"] = page_permission.select temp["delete"] = page_permission.delete if temp: group_permissions.append(temp) return self.render( PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_HTML, group_name=group_name, group_permissions=group_permissions, pages=page_list, previous=previous, next=next, page=page, home_list_url=MANAGEMENT_PERMISSION_HOME_URL, list_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_URL, detail_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DETAIL_URL, add_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_ADD_URL + "?id=" + str(group_id), delete_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DELETE_URL, )
def get(self): the_get = Get() user_instance = User() relation_instance = UserAndMatchCondition() username = the_get.get_username(self) name = the_get.get_name(self) match_condition_ids = the_get.get_id(self) if username is None: username = "" if name is None: name = "" if match_condition_ids is None: match_condition_ids = "" query = relation_instance.find(username, name, match_condition_ids) 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, count = relation_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() relations = list() for u in query: temp = dict() temp["id"] = u.id temp["user_id"] = u.user_id temp["match_condition_id"] = u.match_condition_id if u.name is not None: temp["name"] = u.name else: temp["name"] = "" the_user = user_instance.get_by_id(u.user_id) if the_user: temp["username"] = the_user.username else: temp["username"] = "" relations.append(temp) return self.render( USER_AND_MATCH_CONDITION_LIST_HTML, relations=relations, pages=page_list, previous=previous, next=next, page=page, list_url=USER_AND_MATCH_CONDITION_LIST_URL, detail_url=USER_AND_MATCH_CONDITION_DETAIL_URL, add_url=USER_AND_MATCH_CONDITION_ADD_URL, delete_url=USER_AND_MATCH_CONDITION_DELETE_URL, username=username, name=name, match_condition_ids=match_condition_ids, )