DmitrMakeev commited on
Commit
f759145
·
verified ·
1 Parent(s): 04d0001

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -695,7 +695,7 @@ def show_contacts():
695
  contacts = cursor.fetchall()
696
  conn.close()
697
 
698
- # HTML template for displaying contacts table
699
  html = '''
700
  <!doctype html>
701
  <html lang="en">
@@ -725,18 +725,23 @@ def show_contacts():
725
  <th>Name</th>
726
  <th>Phone</th>
727
  <th>Email</th>
 
 
 
 
 
728
  </tr>
729
  {% for contact in contacts %}
730
- <tr>
731
- <td>{{ contact[0] }}</td> <!-- Имя -->
732
- <td>{{ contact[1] }}</td> <!-- Почта -->
733
- <td>{{ contact[2] }}</td> <!-- Телефон -->
734
- <td>{{ contact[3] }}</td> <!-- pr1 -->
735
- <td>{{ contact[4] }}</td> <!-- pr2 -->
736
- <td>{{ contact[5] }}</td> <!-- pr3 -->
737
- <td>{{ contact[6] }}</td> <!-- pr4 -->
738
- <td>{{ contact[7] }}</td> <!-- pr5 -->
739
- </tr>
740
  {% endfor %}
741
  </table>
742
  </body>
@@ -744,11 +749,6 @@ def show_contacts():
744
  '''
745
 
746
  return render_template_string(html, contacts=contacts)
747
-
748
- except sqlite3.Error as e:
749
- print(f"SQLite error: {e}")
750
- return "Database error. Please try again later.", 500
751
-
752
  except Exception as e:
753
  print(f"Error showing contacts: {e}")
754
  return "Internal Server Error", 500
@@ -768,7 +768,6 @@ def show_contacts():
768
 
769
 
770
 
771
-
772
 
773
 
774
  if __name__ == '__main__':
 
695
  contacts = cursor.fetchall()
696
  conn.close()
697
 
698
+ # HTML-шаблон для отображения таблицы
699
  html = '''
700
  <!doctype html>
701
  <html lang="en">
 
725
  <th>Name</th>
726
  <th>Phone</th>
727
  <th>Email</th>
728
+ <th>pr1</th>
729
+ <th>pr2</th>
730
+ <th>pr3</th>
731
+ <th>pr4</th>
732
+ <th>pr5</th>
733
  </tr>
734
  {% for contact in contacts %}
735
+ <tr>
736
+ <td>{{ contact[0] }}</td>
737
+ <td>{{ contact[1] }}</td>
738
+ <td>{{ contact[2] }}</td>
739
+ <td>{{ contact[3] }}</td>
740
+ <td>{{ contact[4] }}</td>
741
+ <td>{{ contact[5] }}</td>
742
+ <td>{{ contact[6] }}</td>
743
+ <td>{{ contact[7] }}</td>
744
+ </tr>
745
  {% endfor %}
746
  </table>
747
  </body>
 
749
  '''
750
 
751
  return render_template_string(html, contacts=contacts)
 
 
 
 
 
752
  except Exception as e:
753
  print(f"Error showing contacts: {e}")
754
  return "Internal Server Error", 500
 
768
 
769
 
770
 
 
771
 
772
 
773
  if __name__ == '__main__':