Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -741,65 +741,7 @@ def show_contacts():
|
|
| 741 |
cursor.execute('SELECT name, email, phone, pr1, pr2, pr3, pr4, pr5, date, time FROM contacts')
|
| 742 |
contacts = cursor.fetchall()
|
| 743 |
conn.close()
|
| 744 |
-
|
| 745 |
-
# HTML-шаблон для отображения таблицы
|
| 746 |
-
html = '''
|
| 747 |
-
<!doctype html>
|
| 748 |
-
<html lang="en">
|
| 749 |
-
<head>
|
| 750 |
-
<meta charset="utf-8">
|
| 751 |
-
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
| 752 |
-
<title>Contacts</title>
|
| 753 |
-
<style>
|
| 754 |
-
table {
|
| 755 |
-
width: 70%;
|
| 756 |
-
border-collapse: collapse;
|
| 757 |
-
}
|
| 758 |
-
th, td {
|
| 759 |
-
border: 1px solid black;
|
| 760 |
-
padding: 8px;
|
| 761 |
-
text-align: left;
|
| 762 |
-
}
|
| 763 |
-
th {
|
| 764 |
-
background-color: #f2f2f2;
|
| 765 |
-
}
|
| 766 |
-
</style>
|
| 767 |
-
</head>
|
| 768 |
-
<body>
|
| 769 |
-
<h1>Contacts</h1>
|
| 770 |
-
<table>
|
| 771 |
-
<tr>
|
| 772 |
-
<th>Name</th>
|
| 773 |
-
<th>Email</th>
|
| 774 |
-
<th>Phone</th>
|
| 775 |
-
<th>PR1</th>
|
| 776 |
-
<th>PR2</th>
|
| 777 |
-
<th>PR3</th>
|
| 778 |
-
<th>PR4</th>
|
| 779 |
-
<th>PR5</th>
|
| 780 |
-
<th>Date</th>
|
| 781 |
-
<th>Time</th>
|
| 782 |
-
</tr>
|
| 783 |
-
{% for contact in contacts %}
|
| 784 |
-
<tr>
|
| 785 |
-
<td>{{ contact[0] }}</td>
|
| 786 |
-
<td>{{ contact[1] }}</td>
|
| 787 |
-
<td>{{ contact[2] }}</td>
|
| 788 |
-
<td>{{ contact[3] }}</td>
|
| 789 |
-
<td>{{ contact[4] }}</td>
|
| 790 |
-
<td>{{ contact[5] }}</td>
|
| 791 |
-
<td>{{ contact[6] }}</td>
|
| 792 |
-
<td>{{ contact[7] }}</td>
|
| 793 |
-
<td>{{ contact[8] }}</td>
|
| 794 |
-
<td>{{ contact[9] }}</td>
|
| 795 |
-
</tr>
|
| 796 |
-
{% endfor %}
|
| 797 |
-
</table>
|
| 798 |
-
</body>
|
| 799 |
-
</html>
|
| 800 |
-
'''
|
| 801 |
-
|
| 802 |
-
return render_template_string(html, contacts=contacts)
|
| 803 |
except Exception as e:
|
| 804 |
print(f"Error showing contacts: {e}")
|
| 805 |
return "Database error. Please try again later.", 500
|
|
|
|
| 741 |
cursor.execute('SELECT name, email, phone, pr1, pr2, pr3, pr4, pr5, date, time FROM contacts')
|
| 742 |
contacts = cursor.fetchall()
|
| 743 |
conn.close()
|
| 744 |
+
return render_template('contacts.html', contacts=contacts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 745 |
except Exception as e:
|
| 746 |
print(f"Error showing contacts: {e}")
|
| 747 |
return "Database error. Please try again later.", 500
|