first commit

This commit is contained in:
2025-11-12 10:57:01 +08:00
commit 79b33e45dc
37 changed files with 416 additions and 0 deletions

18
templates/user_add.html Normal file
View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>添加用户</title>
</head>
<body>
<h2>创建用户</h2>
<form action="/myapp/user/" method="post">
{% csrf_token %} <!-- 关键添加这行代码新版默认自带安全组件提交时要提交csrf的token -->
姓名: <input type="text" name="name"> <br>
城市: <input type="text" name="city"> <br>
性别: <input type="text" name="sex"> <br>
年龄: <input type="text" name="age"> <br>
<input type="submit" value="提交"> <br>
</form>
</body>
</html>

31
templates/user_list.html Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>用户信息管理</title>
</head>
<body>
<h2>用户信息管理</h2>
<table border="1">
<thead>
<tr>
<th>姓名</th>
<th>城市</th>
<th>性别</th>
<th>年龄</th>
</tr>
</thead>
<tbody>
{% for i in users %}
<tr>
<td>{{ i.name }}</td>
<td>{{ i.city }}</td>
<td>{{ i.sex }}</td>
<td>{{ i.age }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<button><a href="/myapp/user_add" target="_blank">创建用户</a></button>
</body>
</html>