当前位置:   article > 正文

Flask+MySQL学生信息维护系统_flask学生信息管理

flask学生信息管理

 Python课程期末项目,小白一个

【学生信息维护系统项目概述】

        学生管理系统是一个基于 Python 的 Flask + MySQL 项目,旨在实现对学生信息的管理和查询。该系统主要包括学生信息录入、信息查询、信息修改和信息删除,信息可视化等功能,以提高学校或教育机构对学生信息的管理效率和准确性。

【功能要求】

  1. 学生信息录入:管理员可以添加学生信息,包括学生学号、姓名、性别、年龄等。
  2. 学生信息查询:管理员可以根据学生姓名、学号条件进行学生信息的查询,并展示查询结果。
  3. 学生信息修改:管理员可以根据学生学号进行学生信息的修改,包括姓名、性别、年龄等。
  4. 学生信息删除:管理员可以根据学生学号进行学生信息的删除操作。
  5. 学生信息排序:管理员可以根据学生年龄进行学生信息的升序排序
  6. 数据统计与分析:系统可以进行学生信息的统计和分析,如统计男女性别比例,并以饼状图显示
  7. 登录与访问控制:系统需要实现用户登录功能,并对访问系统的权限进行控制,确保只有授权用户可以进行相关操作

【运行视频】

https://www.bilibili.com/video/BV1BV4y1y7aG/?spm_id_from=333.999.0.0&vd_source=3ea11718fcda196523e3437c32bc83a6

【项目结构】

templates放的是前端代码,static是前端页面的美化文件,chart.png是生成的性别比例饼图

【数据库】

使用的MySQL数据库,8.0.26版本

数据库名flask,表名student

 

【登录功能】

登录功能没有使用数据库连接,直接写死了

可以通过设置Method指定提交方式为GET或者POST提交方式,默认为GET提交方式。

  1. @app.route('/login', methods=['GET', 'POST']) # 登录功能
  2. def user_login():
  3. if request.method == 'GET':
  4. return render_template('login.html')
  5. username = request.form.get('username')
  6. password = request.form.get('password')
  7. if username == 'admin' and password == '123':
  8. return redirect(url_for('admin'))
  9. elif username == '' or password == '':
  10. js_code = "<script>alert('请输入账号密码!'); history.back();</script>"
  11. return js_code
  12. else:
  13. js_code = "<script>alert('登陆失败!'); history.back();</script>"
  14. return js_code
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <html>
  4. <head>
  5. <meta charset="utf-8"/>
  6. <title>Login</title>
  7. <link rel="stylesheet" type="text/css" href="../static/css/index.css"/>
  8. <link rel="stylesheet" type="text/css" href="../static/css/iconfont.css"/>
  9. </head>
  10. <body>
  11. <form action="/login" method="post">
  12. <div id="login-box">
  13. <h1>Login</h1>
  14. <div class="input-box">
  15. <i class="iconfont">&#xe609;</i>
  16. <input name="username" type="text" class="loginuser" value="" placeholder="UserName"/>
  17. </div>
  18. <div class="input-box">
  19. <i class="iconfont">&#xe605;</i>
  20. <input name="password" type="password" class="loginpwd" value="" placeholder="UserPassword"/>
  21. </div>
  22. <button type="submit" class="btn btn-primary">登录</button>
  23. </div>
  24. </form>
  25. </body>
  26. </html>

 【添加学生信息】

通过前端获取的信息进行判断,再进入数据库

  1. @app.route('/add', methods=['GET', 'POST']) # 添加学生
  2. def add():
  3. if request.method == 'GET':
  4. return render_template('add.html')
  5. else:
  6. id = request.form.get('id')
  7. name = request.form.get('name')
  8. sex = request.form.get('sex')
  9. age = request.form.get('age')
  10. stu = getStudent(id)
  11. if id == "" or name == "" or sex == "" or age == "":
  12. js_code = "<script>alert('请填写完整信息!'); history.back();</script>"
  13. return js_code
  14. elif stu:
  15. js_code = "<script>alert('学生已存在!'); history.back();</script>"
  16. return js_code
  17. else:
  18. addstudent(id, name, sex, age)
  19. return redirect(url_for('admin'))
  20. def addstudent(id, name, sex, age):
  21. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  22. cursor = db.cursor()
  23. sql = "insert into student (id,name,sex,age) values ('" + id + "','" + name + "','" + sex + "','" + age + "')"
  24. cursor.execute(sql)
  25. db.commit()
  26. db.close()
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <html>
  4. <head>
  5. <meta charset="utf-8"/>
  6. <title>新增数据</title>
  7. <link rel="stylesheet" type="text/css" href="../static/css/bootstrap.css"/>
  8. </head>
  9. <body>
  10. <form action="/add" style="width: 400px; margin: 100px auto" method="post">
  11. <div class="mb-3">
  12. <label for="id" class="form-label">学号</label>
  13. <input type="text" class="form-control" id="id" aria-describedby="emailHelp" name="id">
  14. </div>
  15. <div class="mb-3">
  16. <label for="name" class="form-label">姓名</label>
  17. <input type="text" class="form-control" id="name" name="name">
  18. </div>
  19. <div class="mb-3">
  20. <label for="english" class="form-label">性别</label>
  21. <input type="text" class="form-control" id="sex" name="sex">
  22. </div>
  23. <div class="mb-3">
  24. <label for="python" class="form-label">年龄</label>
  25. <input type="text" class="form-control" id="age" name="age">
  26. </div>
  27. <button type="submit" class="btn btn-primary">添加</button>
  28. </form>
  29. </body>
  30. </html>

【删除学生信息】

通过判断获取id是否存在数据库中进行删除操作

  1. @app.route('/delete/<id>', methods=['GET']) # 删除学生
  2. def delete(id):
  3. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  4. cursor = db.cursor()
  5. sql = "delete from student where id=" + str(id)
  6. cursor.execute(sql)
  7. db.commit()
  8. db.close()
  9. return redirect(url_for('admin'))
  1. <form action="/delete/{{ stu[0] }}" method="get" style="display: inline-block;">
  2. <button type="submit" class="btn btn-outline-danger btn-sm">删除</button>
  3. </form>

【修改学生信息】

先根据学生id读取数据库学生信息,显示在前端表单

再获取修改后的信息,更新数据库

  1. @app.route('/modify/<id>', methods=['GET', 'POST']) # 修改学生
  2. def modify(id):
  3. if request.method == 'GET':
  4. students = getStudents()
  5. editStudent = getStudent(id)
  6. id = editStudent[0]
  7. name = editStudent[1]
  8. sex = editStudent[2]
  9. age = editStudent[3]
  10. return render_template('modify.html', students=students, id=id, name=name, sex=sex, age=age)
  11. else:
  12. id = request.form.get('id')
  13. name = request.form.get('name')
  14. sex = request.form.get('sex')
  15. age = request.form.get('age')
  16. if name == '' or sex == '' or age == '':
  17. js_code = "<script>alert('请输入修改信息!'); history.back();</script>"
  18. return js_code
  19. else:
  20. updateStudent(id, name, sex, age)
  21. return redirect(url_for('admin'))
  22. def updateStudent(id, name, sex, age):
  23. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  24. cursor = db.cursor()
  25. sql = "update student set name='%s',sex='%s', age='%s' WHERE id=%s" % (name, sex, age, id)
  26. cursor.execute(sql)
  27. print(sql)
  28. db.commit()
  29. db.close()
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <html>
  4. <head>
  5. <meta charset="utf-8"/>
  6. <title>修改数据</title>
  7. <link rel="stylesheet" type="text/css" href="../static/css/bootstrap.css"/>
  8. </head>
  9. <body>
  10. <form action="/modify/{{ id }}" style="width: 400px; margin: 100px auto" method="post">
  11. <div class="mb-3">
  12. <label for="id" class="form-label">学号</label>
  13. <input type="text" class="form-control" id="id" name="id" value="{{ id }}"readonly>
  14. </div>
  15. <div class="mb-3">
  16. <label for="name" class="form-label">姓名</label>
  17. <input type="text" class="form-control" id="name" name="name" value="{{ name }}">
  18. </div>
  19. <div class="mb-3">
  20. <label for="english" class="form-label">性别</label>
  21. <input type="text" class="form-control" id="sex" name="sex" value="{{ sex }}">
  22. </div>
  23. <div class="mb-3">
  24. <label for="python" class="form-label">年龄</label>
  25. <input type="text" class="form-control" id="age" name="age" value="{{ age }}">
  26. </div>
  27. <button type="submit" class="btn btn-primary">修改</button>
  28. </form>
  29. </body>
  30. </html>

【查询学生信息】

根据姓名查询为模糊查询

根据学号查询诶精准查询

  1. @app.route('/search', methods=['POST']) # 查询学生
  2. def search():
  3. if request.form.get('name') != '': # 根据姓名查询
  4. name = request.form.get('name')
  5. students = searchstudents(name)
  6. return render_template('admin.html', student=students)
  7. elif request.form.get('id') != '': # 根据学号查询
  8. id = request.form.get('id')
  9. students1 = searchstu1(id)
  10. return render_template('admin.html', student=students1)
  11. elif request.form.get('id') == '' and request.form.get('name') == '':
  12. js_code = "<script>alert('请输入查询内容!'); history.back();</script>"
  13. return js_code
  14. def searchstudents(name):
  15. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  16. cursor = db.cursor()
  17. sql = "select * from student where name like '%" + name + "%'"
  18. cursor.execute(sql)
  19. rows = cursor.fetchall()
  20. for row in rows:
  21. print(row[1])
  22. db.close()
  23. return rows
  24. def searchstu1(id):
  25. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  26. cursor = db.cursor()
  27. sql = f"select * from student where id={id}"
  28. cursor.execute(sql)
  29. rows = cursor.fetchall()
  30. for row in rows:
  31. print(row[1])
  32. db.close()
  33. return rows
  1. <form action="/search" class="row g-3" method="post">
  2. <div class="col-auto">
  3. <label class="visually-hidden">学号</label>
  4. <input type="text" class="form-control" name="id" placeholder="学号">
  5. </div>
  6. <div class="col-auto">
  7. <label class="visually-hidden">姓名</label>
  8. <input type="text" class="form-control" name="name" placeholder="姓名">
  9. </div>
  10. <div class="col-auto">
  11. <button type="submit" class="btn btn-outline-success mb-3">查找</button>
  12. </div>
  13. </form>

【排序学生信息】

读取学生年龄,ASC升序排序

  1. @app.route('/sort', methods=['GET']) # 根据年龄排序
  2. def sort():
  3. students = get_Sort_Students()
  4. return render_template('admin.html', student=students)
  5. def get_Sort_Students():
  6. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  7. cursor = db.cursor()
  8. sql = "select * from student order by age asc"
  9. cursor.execute(sql)
  10. row = cursor.fetchall()
  11. db.close()
  12. return row
  1. <form action="/sort" class="row g-3">
  2. <div class="col-auto">
  3. <button type="submit" class="btn btn-outline-info mb-3">排序</button>
  4. </div>
  5. </form>

【学生信息可视化】

将数据库读取到的性别比例写为列表,再创建饼图

  1. @app.route('/home')
  2. def home():
  3. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  4. cursor = db.cursor()
  5. query = "select sex, count(*) from student group by sex"
  6. cursor.execute(query)
  7. data = cursor.fetchall()
  8. # 将查询结果转换为列表形式
  9. gender_data = [{'gender': row[0], 'count': row[1]} for row in data]
  10. cursor.close()
  11. db.close()
  12. # 提取性别列表和数量列表
  13. genders = [row['gender'] for row in gender_data]
  14. counts = [row['count'] for row in gender_data]
  15. explode = [0.1, 0]
  16. # 创建饼图
  17. matplotlib.rcParams['font.sans-serif'] = ['SimHei']
  18. plt.pie(counts, labels=genders, autopct='%1.1f%%', explode=explode, shadow=True,
  19. textprops={'fontsize': 16, 'color': 'white'})
  20. plt.axis('equal')
  21. # 保存饼图为图片
  22. chart_path = 'static/chart.png'
  23. plt.savefig(chart_path, transparent=True)
  24. # 渲染模板并传递饼图路径
  25. return render_template('home.html', chart_path=chart_path)
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>性别比例饼图</title>
  6. <link rel="stylesheet" href="../static/css/bootstrap.css">
  7. </head>
  8. <body>
  9. <div class="container">
  10. <div class="row align-items-start">
  11. <div class="col">
  12. <ul class="nav flex-column" style="width: 120px; margin: 40px auto">
  13. <li class="nav-item">
  14. <a class="nav-link active" aria-current="page" href="/admin">管理功能</a>
  15. </li>
  16. <li class="nav-item">
  17. <a class="nav-link" href="/home">可视化功能</a>
  18. </li>
  19. <li class="nav-item">
  20. <a class="nav-link" href="/login">退出登录</a>
  21. </li>
  22. </ul>
  23. </div>
  24. <div class="col">
  25. <div class="text-center" style="width: 933px; margin: 15px auto">
  26. <h1>性别比例饼图</h1>
  27. <img src="{{ chart_path }}" alt="Gender Chart">
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </body>
  33. </html>

【完整代码】

manage.py

  1. # -*- coding: utf-8 -*-
  2. # time: 2023/6/18 10:09
  3. # file: manage.py
  4. # author: sober
  5. import matplotlib
  6. from flask import Flask, request, render_template, redirect, url_for
  7. import pymysql
  8. from matplotlib import pyplot as plt
  9. app = Flask(__name__)
  10. dbhost = '127.0.0.1'
  11. dbuser = 'root'
  12. dbpass = '123456'
  13. dbname = 'flask'
  14. def getStudents():
  15. # 打开数据库连接 主机地址 用户名 密码 数据库
  16. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  17. cursor = db.cursor()
  18. sql = "select * from student"
  19. cursor.execute(sql)
  20. rows = cursor.fetchall()
  21. db.close()
  22. return rows
  23. def getStudent(id):
  24. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  25. cursor = db.cursor()
  26. sql = "select * from student where id=" + str(id)
  27. cursor.execute(sql)
  28. row = cursor.fetchone()
  29. db.close()
  30. return row
  31. @app.route('/')
  32. def index():
  33. return redirect(url_for('user_login'))
  34. @app.route('/login', methods=['GET', 'POST']) # 登录功能
  35. def user_login():
  36. if request.method == 'GET':
  37. return render_template('login.html')
  38. username = request.form.get('username')
  39. password = request.form.get('password')
  40. if username == 'admin' and password == '123':
  41. return redirect(url_for('admin'))
  42. elif username == '' or password == '':
  43. js_code = "<script>alert('请输入账号密码!'); history.back();</script>"
  44. return js_code
  45. else:
  46. js_code = "<script>alert('登陆失败!'); history.back();</script>"
  47. return js_code
  48. @app.route('/admin', methods=['POST', 'GET']) # 管理功能
  49. def admin():
  50. students = getStudents()
  51. return render_template('admin.html', student=students)
  52. @app.route('/home')
  53. def home():
  54. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  55. cursor = db.cursor()
  56. query = "select sex, count(*) from student group by sex"
  57. cursor.execute(query)
  58. data = cursor.fetchall()
  59. # 将查询结果转换为列表形式
  60. gender_data = [{'gender': row[0], 'count': row[1]} for row in data]
  61. cursor.close()
  62. db.close()
  63. # 提取性别列表和数量列表
  64. genders = [row['gender'] for row in gender_data]
  65. counts = [row['count'] for row in gender_data]
  66. explode = [0.1, 0]
  67. # 创建饼图
  68. matplotlib.rcParams['font.sans-serif'] = ['SimHei']
  69. plt.pie(counts, labels=genders, autopct='%1.1f%%', explode=explode, shadow=True,
  70. textprops={'fontsize': 16, 'color': 'white'})
  71. plt.axis('equal')
  72. # 保存饼图为图片
  73. chart_path = 'static/chart.png'
  74. plt.savefig(chart_path, transparent=True)
  75. # 渲染模板并传递饼图路径
  76. return render_template('home.html', chart_path=chart_path)
  77. @app.route('/add', methods=['GET', 'POST']) # 添加学生
  78. def add():
  79. if request.method == 'GET':
  80. return render_template('add.html')
  81. else:
  82. id = request.form.get('id')
  83. name = request.form.get('name')
  84. sex = request.form.get('sex')
  85. age = request.form.get('age')
  86. stu = getStudent(id)
  87. if id == "" or name == "" or sex == "" or age == "":
  88. js_code = "<script>alert('请填写完整信息!'); history.back();</script>"
  89. return js_code
  90. elif stu:
  91. js_code = "<script>alert('学生已存在!'); history.back();</script>"
  92. return js_code
  93. else:
  94. addstudent(id, name, sex, age)
  95. return redirect(url_for('admin'))
  96. def addstudent(id, name, sex, age):
  97. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  98. cursor = db.cursor()
  99. sql = "insert into student (id,name,sex,age) values ('" + id + "','" + name + "','" + sex + "','" + age + "')"
  100. cursor.execute(sql)
  101. db.commit()
  102. db.close()
  103. @app.route('/sort', methods=['GET']) # 根据年龄排序
  104. def sort():
  105. students = get_Sort_Students()
  106. return render_template('admin.html', student=students)
  107. def get_Sort_Students():
  108. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  109. cursor = db.cursor()
  110. sql = "select * from student order by age asc"
  111. cursor.execute(sql)
  112. row = cursor.fetchall()
  113. db.close()
  114. return row
  115. @app.route('/search', methods=['POST']) # 查询学生
  116. def search():
  117. if request.form.get('name') != '': # 根据姓名查询
  118. name = request.form.get('name')
  119. students = searchstudents(name)
  120. return render_template('admin.html', student=students)
  121. elif request.form.get('id') != '': # 根据学号查询
  122. id = request.form.get('id')
  123. students1 = searchstu1(id)
  124. return render_template('admin.html', student=students1)
  125. elif request.form.get('id') == '' and request.form.get('name') == '':
  126. js_code = "<script>alert('请输入查询内容!'); history.back();</script>"
  127. return js_code
  128. def searchstudents(name):
  129. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  130. cursor = db.cursor()
  131. sql = "select * from student where name like '%" + name + "%'"
  132. cursor.execute(sql)
  133. rows = cursor.fetchall()
  134. for row in rows:
  135. print(row[1])
  136. db.close()
  137. return rows
  138. def searchstu1(id):
  139. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  140. cursor = db.cursor()
  141. sql = f"select * from student where id={id}"
  142. cursor.execute(sql)
  143. rows = cursor.fetchall()
  144. for row in rows:
  145. print(row[1])
  146. db.close()
  147. return rows
  148. @app.route('/modify/<id>', methods=['GET', 'POST']) # 修改学生
  149. def modify(id):
  150. if request.method == 'GET':
  151. students = getStudents()
  152. editStudent = getStudent(id)
  153. id = editStudent[0]
  154. name = editStudent[1]
  155. sex = editStudent[2]
  156. age = editStudent[3]
  157. return render_template('modify.html', students=students, id=id, name=name, sex=sex, age=age)
  158. else:
  159. id = request.form.get('id')
  160. name = request.form.get('name')
  161. sex = request.form.get('sex')
  162. age = request.form.get('age')
  163. if name == '' or sex == '' or age == '':
  164. js_code = "<script>alert('请输入修改信息!'); history.back();</script>"
  165. return js_code
  166. else:
  167. updateStudent(id, name, sex, age)
  168. return redirect(url_for('admin'))
  169. def updateStudent(id, name, sex, age):
  170. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  171. cursor = db.cursor()
  172. sql = "update student set name='%s',sex='%s', age='%s' WHERE id=%s" % (name, sex, age, id)
  173. cursor.execute(sql)
  174. print(sql)
  175. db.commit()
  176. db.close()
  177. @app.route('/delete/<id>', methods=['GET']) # 删除学生
  178. def delete(id):
  179. db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
  180. cursor = db.cursor()
  181. sql = "delete from student where id=" + str(id)
  182. cursor.execute(sql)
  183. db.commit()
  184. db.close()
  185. return redirect(url_for('admin'))
  186. if __name__ == '__main__':
  187. app.run('127.0.0.1', 5002, debug=True)

admin.html

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>学生信息管理</title>
  6. <link rel="stylesheet" href="../static/css/bootstrap.css">
  7. </head>
  8. <body>
  9. <div class="container">
  10. <div class="row align-items-start">
  11. <div class="col">
  12. <ul class="nav flex-column " style="width: 120px; margin: 40px auto">
  13. <li class="nav-item">
  14. <a class="nav-link active" aria-current="page" href="/admin">管理功能</a>
  15. </li>
  16. <li class="nav-item">
  17. <a class="nav-link" href="/home">可视化功能</a>
  18. </li>
  19. <li class="nav-item">
  20. <a class="nav-link" href="/login" >退出登录</a>
  21. </li>
  22. </ul>
  23. </div>
  24. <div class="col">
  25. <table class="table" style="width: 900px; margin: 40px auto">
  26. <thead>
  27. <tr>
  28. <th scope="col">
  29. <form action="/search" class="row g-3" method="post">
  30. <div class="col-auto">
  31. <label class="visually-hidden">学号</label>
  32. <input type="text" class="form-control" name="id" placeholder="学号">
  33. </div>
  34. <div class="col-auto">
  35. <label class="visually-hidden">姓名</label>
  36. <input type="text" class="form-control" name="name" placeholder="姓名">
  37. </div>
  38. <div class="col-auto">
  39. <button type="submit" class="btn btn-outline-success mb-3">查找</button>
  40. </div>
  41. </form>
  42. </th>
  43. <th scope="col">
  44. <form action="/add" class="row g-3">
  45. <div class="col-auto">
  46. <button type="submit" class="btn btn-outline-info mb-3">添加学生</button>
  47. </div>
  48. </form>
  49. </th>
  50. <th scope="col">
  51. <form action="/sort" class="row g-3">
  52. <div class="col-auto">
  53. <button type="submit" class="btn btn-outline-info mb-3">排序</button>
  54. </div>
  55. </form>
  56. </th>
  57. <th scope="col">
  58. <form action="/admin" class="row g-3">
  59. <div class="col-auto">
  60. <button type="submit" class="btn btn-outline-info mb-3">返回</button>
  61. </div>
  62. </form>
  63. </th>
  64. </tr>
  65. </thead>
  66. <tr>
  67. <td colspan="4">
  68. <div class="table-responsive">
  69. <table class="table table-hover" style="width: 900px; margin: 0 auto">
  70. <thead>
  71. <tr>
  72. <th scope="col">学号</th>
  73. <th scope="col">姓名</th>
  74. <th scope="col">性别</th>
  75. <th scope="col">年龄</th>
  76. <th scope="col">操作</th>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. {#
  81. 需要将 Python 对象的数据显示到浏览器上, 模板语法
  82. jinja2(flask) numjucks(javascript) moka(django) vue
  83. jinja2 可以直接在HTML中写 Python 的逻辑
  84. #}
  85. {% for stu in student %}
  86. <tr>
  87. <th>{{ stu[0] }}</th>
  88. <td>{{ stu[1] }}</td>
  89. <td>{{ stu[2] }}</td>
  90. <td>{{ stu[3] }}</td>
  91. <td>
  92. <form action="/delete/{{ stu[0] }}" method="get"
  93. style="display: inline-block;">
  94. <button type="submit" class="btn btn-outline-danger btn-sm">删除
  95. </button>
  96. </form>
  97. <form action="/modify/{{ stu[0] }}" method="get"
  98. style="display: inline-block;">
  99. <button type="submit" class="btn btn-outline-warning btn-sm">修改
  100. </button>
  101. </form>
  102. </td>
  103. </tr>
  104. {% endfor %}
  105. </tbody>
  106. </table>
  107. </div>
  108. </td>
  109. </tr>
  110. </table>
  111. </div>
  112. </div>
  113. </div>
  114. </body>
  115. </html>

【项目截图】

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/432138
推荐阅读
相关标签
  

闽ICP备14008679号