def find_work_like_date_paging(find_string: str, data_start: str, data_stop: str, page_num: str, stylesheet_number: str) -> str: """Create table contain result find from works and data""" with Database() as base: _, cursor = base date_start_correct = data_start.replace('T', ' ') date_stop_correct = data_stop.replace('T', ' ') pages_list = functions.list_of_pages( select_operations.get_all_works_like_word_and_date( cursor, find_string, date_start_correct, date_stop_correct)) works = select_operations.get_all_works_like_word_and_date_limit( cursor, find_string, date_start_correct, date_stop_correct, int(page_num)) works = functions.works_table_add_new_performer(works) result = uhtml.universal_table(table_headers.works_table_name, table_headers.works_table, [list(work) for work in works]) pages_table = uhtml.paging_table( '/find/work/{0}/{1}/{2}/page'.format(find_string, date_start_correct, date_stop_correct), pages_list, int(page_num)) return web_template.result_page(result + pages_table, '/find', str(stylesheet_number))
def add_performer_in_work(work: list) -> str: """Return HTML-table for add new performer to current work""" performers = [] with Database() as base: _, cursor = base performers = select_operations.get_table_current_workers(cursor) result = list() result.append('<table><caption>Добавить исполнителя</caption>') result.append('<tr><th>№</th><th>Параметр</th><th>Содержимое</th></tr>') for i in range(len(table_headers.works_table)): result.append('<tr><td>' + str(i) + '</td><td>' + table_headers.works_table[i] + '</td><td>' + str(work[0][i]) + '</td></tr>') result.append('<form action="/add-performer-result" method="post">') result.append('<tr><td>' + str(len(table_headers.works_table)) + '</td>') result.append('<td>Добавить исполнителя</td><td><select name="' + PERFORMER + '">') for worker in performers: result.append('<option value="' + str(worker[0]) + '">' + str(worker[2]) + '</option>') result.append( '</tr><tr></select></td></tr><tr><td><input type="hidden" name="' + WORK_ID + '" value="' + str(work[0][0]) + '"></td>') result.append('<td>Пароль</td><td><input type="password" name="' + PASSWORD + '" placeholder="Обязательно"></td></tr>') result.append( '<tr><td></td><td>Выполнить</td>' + '<td><input type="submit" value="Добавить"></td></tr></form></table>') return "\n".join(result)
def add_new_work(equip_id: str) -> str: """Function return string contain table to add new work""" date_to_browser = functions.date_to_browser() performers = [] with Database() as base: _, cursor = base performers = select_operations.get_table_current_workers(cursor) result = list() result.append( '<table><caption>Зарегистрировать произведенные работы</caption>') result.append( '<tr><th>ID оборудования</th><th>Причина ремонта</th>' + '<th>описание работ</th><th>Дата и время</th>' + '<th>Исполнители</th><th>Пароль доступа</th><th>Отправить</th></tr>') result.append('<form action="/add-work" method="post"><tr>') result.append('<td><input name="' + EQUIP_ID + '" value="' + str(equip_id) + '" readonly></td>') result.append('<td><textarea name="' + QUERY + '" placeholder="Необязательно"></textarea></td>') result.append('<td><textarea name="' + WORK + '" placeholder="Обязательно"></textarea></td>') result.append('<td><input type="datetime-local" name="' + WORK_DATETIME + '" value="' + date_to_browser + '"></td>') result.append('<td><select name="' + PERFORMER + '">') for perfomer in performers: result.append('<option value=\'' + str(perfomer[0]) + '\'>' + str(perfomer[2]) + '</option>') result.append('</select></td>') result.append('<td><input type="password" name="' + PASSWORD + '" placeholder="Обязательно"></td>') result.append('<td><input type="submit" value="Отправить"></td>') result.append('</tr></form></table>') return "\n".join(result)
def upgrade_equip_method(data, method, stylesheet_number: str) -> str: """Upgrade database if all values is correct and return html-page""" pre_adr = '/all-equips' if method == "POST": equip_name = data[uhtml.EQUIP_NAME] equip_id = data[uhtml.EQUIP_ID] equip_model = data[uhtml.MODEL] equip_number = data[uhtml.SERIAL_NUM] equip_pre_id = data[uhtml.PRE_ID] password = data[uhtml.PASSWORD] if functions.is_superuser_password(password): if equip_name.replace(" ", '') == '': page = uhtml.data_is_not_valid() else: with Database() as base: connection, cursor = base update_operations.update_equip_information(cursor, equip_id, equip_name, equip_model, equip_number, equip_pre_id) connection.commit() page = uhtml.operation_completed() else: page = uhtml.pass_is_not_valid() else: page = "Method in Edit Point not corrected!" return web_template.result_page(page, pre_adr, str(stylesheet_number))
def equip_to_point_limit(point_id, page_num, stylesheet_number: str) -> str: """Method create table contain equips. Use limit view on page""" with Database() as base: _, cursor = base all_equips = select_operations.get_equip_in_point_limit(cursor, point_id, page_num) links_list = ['/work/{}'.format(equip[0]) for equip in all_equips] data = [[equip[i] for i in range(0, len(equip))] for equip in all_equips] for i, row in enumerate(data): extended_links = ['<a href="/edit-equip/{0}" title="Редактировать">{1}</a>'. format(row[0], EDIT_CHAR) + ' ' + ('<a href="/change-point/{0}" title="Переместить ' + 'на другой обьект">{1}</a>'). format(row[0], REMOVE_CHAR)] if row[0] != row[5]: extended_links[0] += ' ' + \ '<a href="/remove-table/{0}" title="' \ 'Таблица перемещений">{1}</a>'. \ format(row[0], TABLE_REMOVE_CHAR) data[i] = row[1:] + extended_links table1 = uhtml.universal_table(table_headers.equips_table_name, table_headers.equips_table, data, True, links_list) pages = uhtml.paging_table("/equip/{0}/page".format(point_id), functions. list_of_pages(select_operations. get_equip_in_point(cursor, str(point_id))), int(page_num)) table2 = uhtml.add_new_equip(point_id) if point_id != '0' else "" return web_template.result_page(table1 + pages + table2, '/all-points', str(stylesheet_number))
def add_work_method(data, method, stylesheet_number: str) -> str: """Method add new work in database""" if method == "POST": password = data[uhtml.PASSWORD] equip_id = data[uhtml.EQUIP_ID] query = data[uhtml.QUERY] work = data[uhtml.WORK] work_datetime = data[uhtml.WORK_DATETIME].replace("T", ' ') + ':00' pre_adr = '/work/' + str(equip_id) perfomer = data[uhtml.PERFORMER] if functions.is_valid_password(password): if work.replace(" ", "") == '': page = uhtml.data_is_not_valid() else: with Database() as base: connection, cursor = base insert_operations.create_new_work(cursor, equip_id, work_datetime, query, work, perfomer) connection.commit() page = uhtml.operation_completed() else: page = uhtml.pass_is_not_valid() else: page = "Method in Add Work not corrected!" pre_adr = '/' return web_template.result_page(page, pre_adr, str(stylesheet_number))
def database_server_is_work(cls) -> bool: """Return database status""" try: with Database() as base: _, _ = base return True except psycopg2.ConnectionException: return False
def all_bugs_in_work_table(stylesheet_number: str) -> str: """Method create page. contain all unclosed bugs""" with Database() as base: _, cursor = base bugs_list = select_operations.get_all_bugz_in_work_in_bugzilla(cursor) table = uhtml.universal_table(table_headers.bugs_table_name, table_headers.bugs_table, bugs_list) return web_template.result_page(table, '/bugs', str(stylesheet_number))
def update_row(id_worker: str, number_row: int) -> None: """Function update row in table after update information in database""" with Database() as base_local: _, cursor_local = base_local worker_info = get_info_from_worker(cursor_local, id_worker) for col_number in range(len(worker_info)): table.setItem(number_row, col_number, QTableWidgetItem(str(worker_info[col_number])))
def edit_equip_method(equip_id: str, stylesheet_number: str) -> str: """Return page for edit equips information""" with Database() as base: _, cursor = base equip = select_operations.get_full_equip_information(cursor, str(equip_id)) page = uhtml.edit_equip_information([equip_id] + equip) return web_template.result_page(page, '/all-equips', str(stylesheet_number))
def reverse_status(id_worker: str, number_row: int) -> None: """This function reverse status from selected worker""" with Database() as base_local: connection, cursor_local = base_local invert_worker_status(cursor_local, id_worker) connection.commit() update_row(id_worker, number_row)
def all_registered_orders_table(stylesheet_number: str) -> str: """Function create page. contain list of all registered orders""" with Database() as base: _, cursor = base table = uhtml.universal_table(table_headers.orders_table_name, table_headers.orders_table, select_operations.get_all_orders(cursor)) return web_template.result_page(table, '/orders-and-customers', str(stylesheet_number))
def select_point_to_equip_method(equip_id: str, stylesheet_number: str) -> str: """Create form to select new point to current equip""" with Database() as base: _, cursor = base equip = select_operations.get_full_equip_information(cursor, str(equip_id)) point_id = select_operations.get_point_id_from_equip_id(cursor, equip_id) equip = [equip_id] + equip page = uhtml.select_point_form(equip, point_id) return web_template.result_page(page, '/', str(stylesheet_number))
def add_equip_method(data, method, stylesheet_number: str) -> str: """Create page from ADD NEW EQUIP""" if method == "POST": point_id = data[uhtml.POINT_ID] equip_name = data[uhtml.EQUIP_NAME] model = data[uhtml.MODEL] serial_num = data[uhtml.SERIAL_NUM] pre_id = data[uhtml.PRE_ID] password = data[uhtml.PASSWORD] if functions.is_valid_password(password): with Database() as base: connection, cursor = base if equip_name.replace(" ", '') == '': page = uhtml.data_is_not_valid() pre_addr = '/' elif model == '': insert_operations.create_new_equip(cursor, point_id, equip_name) connection.commit() page = uhtml.operation_completed() pre_addr = '/equip/' + str(point_id) elif serial_num == '': insert_operations.create_new_equip(cursor, point_id, equip_name, model) connection.commit() page = uhtml.operation_completed() pre_addr = '/equip/' + str(point_id) elif pre_id == '': insert_operations.create_new_equip(cursor, point_id, equip_name, model, serial_num) connection.commit() page = uhtml.operation_completed() pre_addr = '/equip/' + str(point_id) else: insert_operations.create_new_equip(cursor, point_id, equip_name, model, serial_num, pre_id) connection.commit() page = uhtml.operation_completed() pre_addr = '/equip/' + str(point_id) else: page = uhtml.pass_is_not_valid() pre_addr = '/equip/' + str(point_id) else: page = 'Method in Add Equip not corrected!' pre_addr = '/all-points' return web_template.result_page(page, pre_addr, str(stylesheet_number))
def statistics_page(preview_page, stylesheet_number: str) -> str: """Function create STATISTIC web-page""" with Database() as base: _, cursor = base statistics = select_operations.get_statistic(cursor) links_list = ['/equip/' + str(elem[0]) for elem in statistics] result = uhtml.universal_table(table_headers.statistics_table_name, table_headers.statistics_table, [[elem[i] for i in range(1, len(elem))] for elem in statistics], True, links_list) return web_template.result_page(result, preview_page, str(stylesheet_number))
def find_equip_to_id_page(stylesheet_number: str) -> str: """Create page to FIND equip FROM EQUIP_ID""" with Database() as base: _, cursor = base max_equip_id = select_operations.get_maximal_equip_id(cursor) find_table = list() find_table.append('<table><caption>Поиск оборудования по уникальному ID</caption>') find_table.append('<form action="/select-equip-to-id" method="post">') find_table.append('<tr><td><input type="number" name="id" min="0" max="' + max_equip_id + '"></td></tr>') find_table.append('<tr><td><input type="submit" value="Найти"></td></tr>') return web_template.result_page("\n".join(find_table), '/equips', str(stylesheet_number))
def find_work_to_id_page(stylesheet_number: str) -> str: """Return page, contain form to find work like WORK_ID""" with Database() as base: _, cursor = base max_work_id = select_operations.get_maximal_work_id(cursor) find_table = list() find_table.append( '<table><caption>Поиск выполненной работы по уникальному ID</caption>' ) find_table.append('<form action="/select-work-to-id" method="post">') find_table.append( '<tr><td><input type="number" name="id" min="0" max="' + max_work_id + '"></td></tr>') find_table.append( '<tr><td><input type="submit" value="Найти"></td></tr>') return web_template.result_page("\n".join(find_table), '/works', str(stylesheet_number))
def stat_window(window: SimpleGui, main_layout: QLayout): """This function repaint main window from statistic table""" children: list = window.children() hide_all_children(window) return_button = QPushButton("Вернуться") with Database() as base: _, cursor = base statistic = get_statistic(cursor) table = QTableWidget() table.setColumnCount(4) table.setRowCount(len(statistic)) minimal_width = 40 for col in range(len(statistic[0]) - 1): table.setHorizontalHeaderItem( col, QTableWidgetItem(statistics_table[col])) for row in range(len(statistic)): for col in range(1, len(statistic[0])): table.setItem(row, col - 1, QTableWidgetItem(str(statistic[row][col]))) table.resizeColumnsToContents() table.verticalHeader().setVisible(False) for col in range(len(statistic[0]) - 1): minimal_width = minimal_width + table.columnWidth(col) window.setFixedWidth(minimal_width) window.center() main_layout.addWidget(table) def return_function(): """This function delete all new widgets and repair old""" return_button.hide() main_layout.removeWidget(return_button) table.hide() main_layout.removeWidget(table) show_all_children_in_list(children) return_button.setParent(None) table.setParent(None) window.set_starting_size() return_button.clicked.connect(return_function) main_layout.addWidget(return_button)
def find_work_paging(find_string: str, page_num: str, stylesheet_number: str) -> str: """Create table contain result find from only works""" with Database() as base: _, cursor = base works = select_operations.get_all_works_like_word_limit( cursor, find_string, int(page_num)) works = functions.works_table_add_new_performer(works) pages_list = functions.list_of_pages( select_operations.get_all_works_like_word(cursor, find_string)) result = uhtml.universal_table(table_headers.works_table_name, table_headers.works_table, [list(work) for work in works]) pages_table = uhtml.paging_table( '/find/work/{0}/page'.format(find_string), pages_list, int(page_num)) return web_template.result_page(result + pages_table, '/find', str(stylesheet_number))
def faq_page(pre_adr: str, stylesheet_number: str) -> str: """Function create FAQ web-page""" with Database() as base: _, cursor = base page = list() page.append( '<table><caption>Наиболее частые вопросы по системе:</caption><tr><td>' ) page.append('<ul>') page.append('<li class="faq_question">Что нужно для использования системы?'+\ web_template.faq_state_machine('hardware') + '</li>') page.append( '<li class="faq_question">С использованием каких технологий ' + 'написана система?' + web_template.faq_state_machine('tecnology') + '</li>') page.append('<li class="faq_question">Сколько пользователей поддерживает система?' +\ web_template.faq_state_machine('multiuser') + '</li>') page.append('<li class="faq_question">Планируется ли развитие системы?' +\ web_template.faq_state_machine('update') + '</li>') max_equip_id = select_operations.get_maximal_equip_id(cursor) max_point_id = select_operations.get_maximal_points_id(cursor) max_work_id = select_operations.get_maximal_work_id(cursor) page.append('<li class="faq_question">Сколько записей зарегистрированно на ' + ' данный момент?' +\ uhtml.list_to_ul(['Единиц или групп оборудования: <a href="' + config.full_address + '/all-equips">' + str(max_equip_id) + '</a>', 'Предприятий: <a href="' + config.full_address + '/all-points">' + str(max_point_id) + '</a>', 'Произведенных работ: <a href="' + config.full_address + '/all-works">' + str(max_work_id) + '</a>']) + '</li>') page.append('<li class="faq_question">Текущий размер базы данных : ' + str(select_operations.get_size_database(cursor)) + '</li>') page.append( '<li class="faq_question">Среднее количество работ на смену : ' + str( select_operations.get_count_unique_works(cursor) / select_operations.get_count_unique_dates_in_works(cursor)) + '</li>') page.append('</ul></td></tr></table>') return web_template.result_page('\n'.join(page), pre_adr, str(stylesheet_number))
def select_equip_to_id_page(data, method, stylesheet_number: str) -> str: """Create page to select EQUIP from EQUIP_ID""" pre_adr = '/equips' if method == "POST": equip_id = data['id'] if equip_id == '0': return redirect('/all-equips') with Database() as base: _, cursor = base equip = select_operations.get_full_equip_information(cursor, str(equip_id)) links_list = ['/work/' + str(equip_id)] table1 = uhtml.universal_table(table_headers.equips_table_name, table_headers.equips_table, [equip], True, links_list) return web_template.result_page(table1, pre_adr, str(stylesheet_number)) else: return web_template.result_page("Method in Select Equip not corrected!", pre_adr, str(stylesheet_number))
def select_work_to_id_method(data, method, stylesheet_number: str) -> str: """Method return page, contain work likes WORK_ID""" pre_adr = '/works' if method == "POST": work_id = data['id'] if work_id == '0': return redirect('/all-works') with Database() as base: _, cursor = base work = select_operations.get_full_information_to_work( cursor, str(work_id)) work = functions.works_table_add_new_performer([work]) table1 = uhtml.universal_table(table_headers.works_table_name, table_headers.works_table, work) return web_template.result_page(table1, pre_adr, str(stylesheet_number)) else: return web_template.result_page("Method in Select Work not corrected!", pre_adr, str(stylesheet_number))
def done_edit() -> None: """This function update new worker-data elements""" result_ok: bool = True if is_superuser_password(pw.text()): result_ok = result_ok and (False not in [ elem.isalpha() for elem in family_area.text() ]) result_ok = result_ok and (family_area.text() != "") result_ok = result_ok and (False not in [ elem.isalpha() for elem in name_area.text() ]) result_ok = result_ok and (name_area.text() != "") result_ok = result_ok and (False not in [ elem.isdigit() or elem == ' ' or elem == '-' or elem == '+' for elem in phone_area.text() ]) result_ok = result_ok and (phone_area.text() != "") if not result_ok: err_message_box("Некорректные данные!") else: result_ok = family_area.text() != worker_info[1] or\ name_area.text() != worker_info[2] or\ phone_area.text() != worker_info[3] or\ grade_box.currentText() != worker_info[5] if not result_ok: err_message_box("Данные не изменены!") else: with Database() as base: connection, local_cursor = base update_worker_info( local_cursor, worker_id, name_area.text(), family_area.text(), phone_area.text(), str(posts[grade_box.currentIndex()][0])) connection.commit() else: err_message_box("Неверный пароль администратора!") result_ok = False if result_ok: return_function() else: return
def find_equip_page(find_string: str, page_num: str, stylesheet_number: str) -> str: """Create table contains result find from equips only""" with Database() as base: _, cursor = base equips = select_operations.get_all_equips_list_from_like_str_limit( cursor, find_string, int(page_num)) pages_list = functions.list_of_pages( select_operations.get_all_equips_list_from_like_str( cursor, find_string)) links_list = ['/work/' + str(equip[0]) for equip in equips] result = uhtml.universal_table( table_headers.equips_table_name, table_headers.equips_table, [[equip[i] for i in range(1, len(equip))] for equip in equips], True, links_list) pages_table = uhtml.paging_table( '/find/equip/{0}/page'.format(find_string), pages_list, int(page_num)) return web_template.result_page(result + pages_table, '/find', str(stylesheet_number))
def remove_table_page(equip_id: str, stylesheet_number: str) -> str: """Method create table for all moving equip""" result = [] with Database() as base: _, cursor = base equip_info = [str(equip_id)] +\ select_operations.get_full_equip_information(cursor, str(equip_id)) result.insert(0, equip_info) while str(equip_info[0]) != str(equip_info[5]): old_equip_id = str(equip_info[5]) equip_info = [old_equip_id] +\ select_operations.get_full_equip_information(cursor, old_equip_id) result.insert(0, equip_info) links = ['/work/{0}'.format(elem[0]) for elem in result] page = uhtml.universal_table(table_headers.remove_table_name, table_headers.remove_table, result, True, links) return web_template.result_page(page, "/", str(stylesheet_number))
def find_point_page(find_string: str, page_num: str, stylesheet_number: str) -> str: """Create table contain result find from only works points""" with Database() as base: _, cursor = base points = select_operations.get_all_points_list_from_like_str_limit( cursor, find_string, int(page_num)) pages_list = functions.list_of_pages( select_operations.get_all_points_list_from_like_str( cursor, find_string)) links_list = ['/equip/' + str(elem[0]) for elem in points] result = uhtml.universal_table(table_headers.points_table_name, table_headers.points_table, [[point[1], point[2], point[3]] for point in points], True, links_list) pages_table = uhtml.paging_table( '/find/point/{0}/page'.format(find_string), pages_list, int(page_num)) return web_template.result_page(result + pages_table, '/find', str(stylesheet_number))
def work_to_equip_paging(equip_id, page_id, stylesheet_number: str) -> str: """Return page, contain works from current equip""" with Database() as base: _, cursor = base pre_adr = ('/equip/' + str(select_operations. get_point_id_from_equip_id(cursor, equip_id))) \ if str(equip_id) != '0' \ else '/works' full_works = select_operations.get_works_from_equip_id_limit( cursor, equip_id, page_id) full_works = functions.works_table_add_new_performer(full_works) table1 = uhtml.universal_table(table_headers.works_table_name, table_headers.works_table, full_works) table2 = uhtml.add_new_work(equip_id) if str(equip_id) != 0 else "" table_paging = uhtml.paging_table( "/work/{0}/page".format(equip_id), functions.list_of_pages( select_operations.get_works_from_equip_id(cursor, equip_id)), int(page_id)) return web_template.result_page(table1 + table_paging + table2, pre_adr, str(stylesheet_number))
def add_bugs_result_table(data, method, stylesheet_number: str) -> str: """Add new bug in bug tracker after use input form to add bug""" if method == 'POST': bug_description = data[uhtml.DESCRIPTION] password = data[uhtml.PASSWORD] pre_adr = '/bugs' if functions.is_valid_password(password): with Database() as base: connection, cursor = base insert_operations.add_new_bug_in_bugzilla( cursor, bug_description) connection.commit() return web_template.result_page(uhtml.operation_completed(), pre_adr, str(stylesheet_number)) else: return web_template.result_page(uhtml.pass_is_not_valid(), pre_adr, str(stylesheet_number)) else: return web_template.result_page('Method in Add New Bug not corrected!', '/bugs', str(stylesheet_number))
def move_equip_method(data, method, stylesheet_number: str) -> str: """Move equip to new point""" pre_adr = '/' if method == 'POST': if functions.is_superuser_password(data[uhtml.PASSWORD]): if data[uhtml.POINT_ID] == data[uhtml.NEW_POINT_ID]: page = uhtml.data_is_not_valid() else: with Database() as base: connection, cursor = base name_old = select_operations.get_point_name_from_id(cursor, str(data[uhtml.POINT_ID])) name_new = select_operations.\ get_point_name_from_id(cursor, str(data[uhtml.NEW_POINT_ID])) date_remove = functions.date_to_browser().replace("T", ' ') + ':00' insert_operations.create_new_work(cursor, str(data[uhtml.EQUIP_ID]), date_remove, "Перемещение оборудования", "Перемещено из {0} в {1}.". format(name_old, name_new), '1') insert_operations.create_new_equip(cursor, data[uhtml.NEW_POINT_ID], data[uhtml.EQUIP_NAME], data[uhtml.MODEL], str(data[uhtml.SERIAL_NUM]), str(data[uhtml.EQUIP_ID])) connection.commit() page = uhtml.operation_completed() else: page = uhtml.pass_is_not_valid() else: page = "Method in Move Point not corrected!" return web_template.result_page(page, pre_adr, str(stylesheet_number))
def select_point_form(equip: list, point_id: str) -> str: """Create form to generate html-page to remove equip in new point""" result = list() result.append('<table><caption>Перемещение оборудования</caption>') result.append('<tr><th>№</th><th>Параметр</th><th>Значение</th></tr>') result.append('<form action="/remove-equip" method = "post">') result.append('<tr><td>1</td><td>ID</td><td>' + equip[0] + '</td></tr>') result.append('<input type="hidden" name="' + EQUIP_ID + '" value="' + equip[0] + '"></input>') result.append('<tr><td>2</td><td>Текущее предприятие</td><td>' + equip[1] + '</td></tr>') result.append('<input type="hidden" name="' + POINT_ID + '" value="' + point_id + '"></input>') result.append('<tr><td>3</td><td>Наименование</td><td>' + equip[2] + '</td></tr>') result.append('<input type="hidden" name="' + EQUIP_NAME + '" value="' + equip[2] + '"></input>') result.append('<tr><td>4</td><td>Модель</td><td>' + equip[3] + '</td></tr>') result.append('<input type="hidden" name="' + MODEL + '" value="' + equip[3] + '"></input>') result.append('<tr><td>5</td><td>Серийный номер</td><td>' + equip[4] + '</td></tr>') result.append('<input type="hidden" name="' + SERIAL_NUM + '" value="' + equip[4] + '"></input>') result.append('<tr><td>6</td><td>Предыдущий ID</td><td>' + str(equip[5]) + '</td></tr>') result.append('<input type="hidden" name="' + PRE_ID + '" value="' + str(equip[5]) + '"></input>') result.append( '<tr><td>7</td><td>Точка перемещения</td><td><select name="' + NEW_POINT_ID + '">') new_points = [] with Database() as base: _, cursor = base new_points = select_operations.get_all_point_except_id( cursor, str(point_id)) for point in new_points: result.append('<option value="' + str(point[0]) + '">' + str(point[1]) + '</option>') result.append('</select></td></tr>') result.append('<tr><td>7</td><td>Пароль доступа</td>') result.append('<td><input type="password" name="' + PASSWORD + '"></input></td></tr>') result.append('<tr><td>8</td><td>Применить изменения</td>') result.append( '<td><input type="submit" value="Отправить"></input></td></tr>') result.append('</form></table>') return "\n".join(result)