WTForms, SQLAlchemy

This commit is contained in:
DarkCat09 2023-02-20 12:09:43 +04:00
parent 5f328d82d3
commit 03e4c63d38
14 changed files with 227 additions and 22 deletions

View file

@ -5,7 +5,7 @@
{% block content %}
<h1>Add a person to DB</h1>
<form action="/add" method="post">
{{ form.hidden_tag() }}
{{ form.csrf_token }}
{% for field in form %}
{% if field.name != 'csrf_token' %}
<div>

View file

@ -4,13 +4,15 @@
{% block content %}
<h1>Sample database</h1>
<p><a href="/add">Add a user</a></p>
<table>
<tbody>
{% for row in rows %}
<tr>
{% for cell in row %}
<td>{{ cell }}</td>
{% endfor %}
<td>{{ row.id }}</td>
<td>{{ row.email }}</td>
<td>{{ row.name }}</td>
<td>{{ row.age }}</td>
</tr>
{% endfor %}
</tbody>