first commit
This commit is contained in:
18
templates/user_add.html
Normal file
18
templates/user_add.html
Normal 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
31
templates/user_list.html
Normal 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>
|
||||
Reference in New Issue
Block a user