Add migrations and user models crud

This commit is contained in:
gabatxo1312
2026-01-27 01:33:21 +01:00
parent 2141c992d7
commit 30be91390b
13 changed files with 475 additions and 49 deletions
+34 -34
View File
@@ -2,38 +2,38 @@
{% import "components/typography.html" as typography %}
{% block main %}
{{ typography::heading("All users") }}
{{ typography::heading("All users") }}
<table class="table table-hover">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Nombre de livres</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Jean</td>
<td>34</td>
<td>
<a href='#' class="btn btn-danger btn-sm">
Delete
</a>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Pierre</td>
<td>34</td>
<td>
<a href='#' class="btn btn-danger btn-sm">
Delete
</a>
</td>
</tr>
</tbody>
</table>
{% endblock %}
<table class="table table-hover">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Nombre de livres</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<th scope="row">{{ user.id }}</th>
<td>{{ user.name }}</td>
<td>10</td>
<td>
<form method="post" action="/users/{{ user.id }}">
<input value="Delete" type="submit" class="btn btn-danger btn-sm">
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<form action="/users" method="post">
<label class="form-label">Name</label>
<input type="text" name="name" class="form-control">
<input type="submit" value="Create user" class="btn btn-success mt-3">
</form>
{% endblock %}