首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

基于python开发的简单的学生管理系统

后端 1.16MB 25 需要积分: 1
立即下载

资源介绍:

设置了0积分下载,欢迎下载学习 Django的小试牛刀
from django.shortcuts import render from django.http import HttpResponse from . import models # Create your views here. def home(request): return render(request, "home.html") LoginId = 0 def login(request): #判断请求类型 if request.method =="GET": return render(request, "login.html") else: #从前端表单中获取输入的数据,即账号和密码 name = request.POST.get("username", None) pwd = request.POST.get("password", None) #获取数据库中的账号密码数据 emp = models.UserInfo.objects.values("username", "password", "UserId").filter(username=name) #判断根据账号筛选前端输入的数据是否存在于数据库中 if emp.count() == 0: return render(request, "login.html", {"msg": "登录失败,账号不存在"}) else: if emp[0]['password'] == pwd: globals()["LoginId"] = emp[0]['UserId'] return render(request, "welcome.html") else: return render(request, "login.html", {'msg': '登陆失败,密码错误'}) def welcome(request): return render(request, 'welcome.html') ''' def add(request): list = ['id', 'stuname', 'stuphone', 'stuaddress', 'stucollege', 'stumajor'] info = [] for li in list: info.append(request.POST.get(li)) print(info) if globals()["LoginId"] != 1: return HttpResponse('非ROOT权限,无权修改') emp = models.StuInfo.objects.filter(id=(info[0])) if emp.count() != 0: return render(request, 'add.html', {'msg': '该员工已经存在'}) models.StuInfo.objects.create(id=(info[0]), stuname=info[1], stuphone=info[2], stuaddress=info[3], stucollege=info[4], stumajor=info[5]) return render(request, 'add.html', {'msg': 'hello'}) def add(request): msg = '' if request.method == 'POST': id = request.POST.get('id') stuname = request.POST.get('stuname') stuphone = request.POST.get('stuphone') stuaddress = request.POST.get('stuaddress') stucollege = request.POST.get('stucollege') stumajor = request.POST.get('stumajor') stu = models.StuInfo() stu.id = id stu.stuname = stuname stu.stuphone = stuphone stu.stuaddress = stuaddress stu.stucollege = stucollege stu.stumajor = stumajor stu.save() msg = 'success' return render(request, 'add.html', {msg: 'msg'}) def add(request): if request.method=='GET': return render(request, 'add.html') elif request.method == 'POST': id = request.POST.get('id') stuname = request.POST.get('stuname') stuphone = request.POST.get('stuphone') stuaddress = request.POST.get('stuaddress') stucollege = request.POST.get('stucollege') stumajor = request.POST.get('stumajor') stu = models.StuInfo() stu.id = id stu.stuname = stuname stu.stuphone = stuphone stu.stuaddress = stuaddress stu.stucollege = stucollege stu.stumajor = stumajor stu.save() return render(request, 'add.html', {'result': '学生信息添加成功!'}) ''' def add(request): if request.method == 'GET': return render(request, 'add.html') elif request.method =='POST': list = ['id', 'stuname', 'stuphone', 'stuaddress', 'stucollege', 'stumajor'] info = [] for li in list: info.append(request.POST.get(li)) if globals()['LoginId'] != 1: return HttpResponse("非root用户,没有权限添加用户!") s = models.StuInfo.objects.filter(id=info[0]) print(s.count()) #判断是否已存在重复的数据 if len(s) != 0: return render(request, 'add.html', {'err': '学生信息已存在,请勿重复添加'}) stu = models.StuInfo() stu.id = info[0] stu.stuname = info[1] stu.stuphone = info[2] stu.stuaddress = info[3] stu.stucollege = info[4] stu.stumajor = info[5] stu.save() #保存数据 return render(request, 'add.html', {'success': '学生信息添加成功!!'}) ''' def delete(request): if request.method == 'GET': return render(request, 'delete.html') else: id = request.POST.get('id', None) stu = models.StuInfo.objects.filter(id=id) print("==", stu) if stu.count == 0: return render(request, 'delete.html', {'err': '删除失败,没有此学生信息'}) else: models.StuInfo.objects.filter(id=id).delete() return render(request, 'delete.html', {'success': '删除成功'}) ''' def delete(request): info = models.StuInfo.objects.all() if request.method == 'GET': return render(request, 'delete.html', {'info': info}) if globals()['LoginId'] != 1: return render(request, 'delete.html', {'err': '非root用户登录,无权删除!'}) id = request.POST.get('id', None) # print(id) if id.isspace() == True: return render(request, 'delete.html', {'err': '学号不能由空格组成,请重新输入!!!'}) if len(id) == 0: return render(request, 'delete.html', {'err': '学号不能为空,请重新输入!!!'}) emp = models.StuInfo.objects.filter(id=id) if emp.count() == 0: return render(request, 'delete.html', {'err': '该用户不存在,请重新输入!!!'}) if globals()['LoginId'] != 1: return render(request, 'delete.html', {'err': '权限不够,请用 root 账号登录'}) models.StuInfo.objects.filter(id=id).delete() return render(request, 'delete.html', {'info': info, 'success': '删除成功'}) def update(request): if request.method =='GET': return render(request, 'update.html') list = ['id', 'stuname', 'stuphone', 'stuaddress', 'stucollege', 'stumajor'] info = [] for li in list: info.append(request.POST.get(li)) if globals()['LoginId'] != 1: return render(request, 'update.html', {'err': '权限不够,请切换为 root 用户重试'}) id = request.POST.get('id', None) if id.isspace() == True: return render(request, 'update.html', {'err': '学号不能为空格组成,请重新输入!'}) s = models.StuInfo.objects.filter(id=info[0]) if s.count() == 0: return render(request, 'update.html', {'err': '没有此学生信息,无法修改'}) stu = models.StuInfo() stu.id = info[0] stu.stuname = info[1] stu.stuphone = info[2] stu.stuaddress = info[3] stu.stucollege = info[4] stu.stumajor = info[5] stu.save() return render(request, 'update.html', {'success': '学生信息修改成功!'}) def select(request): if request.method =='GET': return render(request, 'select.html') if globals()['LoginId'] != 1: return render(request, 'select.html', {'error': '非 root 用户,无法查看!点击重新登录!'}) #从表单中获取id值 id = request.POST.get('id', None) #判断id不能为空的字符串类型 if id.isspace() == True: return render(request, 'select.html', {'err': "不能为空值,请重新输入!"}) #从数据库根据id值将对应信息赋值给stu stu = models.StuInfo.objects.filter(id=id) if stu.count() == 0: return render(request, 'select.html', {'err': '没有查询到此学生信息,请确定是否录入系统'}) info = models.StuInfo.objects.values('id', 'stuname', 'stuphone', 'stuaddress', 'stucollege', 'stumajor').filter(id=id)[0] print("info=", info) return render(request, 'select.html', info) def info(request): if requ

资源文件列表:

学生管理系统.zip 大约有56个文件
  1. Djangotest/.idea/
  2. Djangotest/.idea/.gitignore 184B
  3. Djangotest/.idea/Djangotest.iml 1.11KB
  4. Djangotest/.idea/inspectionProfiles/
  5. Djangotest/.idea/inspectionProfiles/profiles_settings.xml 174B
  6. Djangotest/.idea/inspectionProfiles/Project_Default.xml 543B
  7. Djangotest/.idea/misc.xml 307B
  8. Djangotest/.idea/modules.xml 279B
  9. Djangotest/.idea/workspace.xml 12.68KB
  10. Djangotest/app/
  11. Djangotest/app/__init__.py
  12. Djangotest/app/__pycache__/
  13. Djangotest/app/__pycache__/__init__.cpython-38.pyc 120B
  14. Djangotest/app/__pycache__/admin.cpython-38.pyc 702B
  15. Djangotest/app/__pycache__/apps.cpython-38.pyc 380B
  16. Djangotest/app/__pycache__/models.cpython-38.pyc 915B
  17. Djangotest/app/__pycache__/urls.cpython-38.pyc 633B
  18. Djangotest/app/__pycache__/views.cpython-38.pyc 4.18KB
  19. Djangotest/app/admin.py 427B
  20. Djangotest/app/apps.py 144B
  21. Djangotest/app/migrations/
  22. Djangotest/app/migrations/__init__.py
  23. Djangotest/app/migrations/__pycache__/
  24. Djangotest/app/migrations/__pycache__/__init__.cpython-38.pyc 131B
  25. Djangotest/app/migrations/__pycache__/0001_initial.cpython-38.pyc 945B
  26. Djangotest/app/migrations/0001_initial.py 1.22KB
  27. Djangotest/app/models.py 865B
  28. Djangotest/app/templates/
  29. Djangotest/app/templates/add.html 1.93KB
  30. Djangotest/app/templates/delete.html 1.82KB
  31. Djangotest/app/templates/home.html 544B
  32. Djangotest/app/templates/info.html 979B
  33. Djangotest/app/templates/login.html 1.69KB
  34. Djangotest/app/templates/select.html 1.87KB
  35. Djangotest/app/templates/update.html 1.81KB
  36. Djangotest/app/templates/welcome.html 1.32KB
  37. Djangotest/app/tests.py 63B
  38. Djangotest/app/urls.py 554B
  39. Djangotest/app/views.py 8KB
  40. Djangotest/db.sqlite3 136KB
  41. Djangotest/Djangotest/
  42. Djangotest/Djangotest/__init__.py 60B
  43. Djangotest/Djangotest/__pycache__/
  44. Djangotest/Djangotest/__pycache__/__init__.cpython-38.pyc 185B
  45. Djangotest/Djangotest/__pycache__/settings.cpython-38.pyc 2.48KB
  46. Djangotest/Djangotest/__pycache__/urls.cpython-38.pyc 951B
  47. Djangotest/Djangotest/__pycache__/wsgi.cpython-38.pyc 536B
  48. Djangotest/Djangotest/asgi.py 413B
  49. Djangotest/Djangotest/settings.py 3.57KB
  50. Djangotest/Djangotest/urls.py 818B
  51. Djangotest/Djangotest/wsgi.py 413B
  52. Djangotest/manage.py 688B
  53. Djangotest/static/
  54. Djangotest/static/1.jpg 25.02KB
  55. Djangotest/static/2.jpg 1.15MB
  56. Djangotest/templates/
0评论
提交 加载更多评论
其他资源 Unity跑酷模型资源
跑酷教程所需要的模型资源,跑酷教程在:htps://blog.csdn.net/q764424567/article/details/78221190
插件《E灵21》有270多个功能,支持WPS和Excel,官方下载
E灵用于强化Excel的功能,提升制表的速度。它包括日期工具、报表批处理工具、合并工具、财务工具、图片工具、重复值工具、文件处理工具、打印工具、一键录入公式等等多种类型的工具集合,适用于各行业的办公文员。 目前最新版本是21.1,包含270多个功能
Qt5.14.0实现百度地图API的调用,使用QWebEngineView实现地图网页的显示
Qt5实现百度地图API的调用——物体轨迹的设计、插入、删除、保存、读取。使用js文件实现Qt和API之间的沟通。https://mp.csdn.net/editor/html/114036591中有项目效果运行截图和简要的说明,欢迎交流。
《J2me手机游戏编程入门》书带源码
《J2me手机游戏编程入门》书带源码
Turbo C 3.0汉化版
Turbo C 3.0汉化版
Synaptics病毒专杀工具
清除病毒,并恢复被病毒破坏的文件。 伪装成“Synaptics触摸板驱动程序”的新型蠕虫病毒,既可以通过带有恶意宏代码的Excel文档传播,也可以通过对正常的EXE文件进行偷梁换柱(将正常的EXE文件内容复制更新到病毒自身的资源段中)的方式传播。 当机器感染该病毒后,其会拦截用户新建Excel文档或者打开Excel文档的行为,并将新建或者打开的Excel文档替换成带有恶意宏代码的文档,恶意的宏代码主要功能是下载并执行病毒的主体文件Synaptics.exe,进一步感染其他机器。
springboot+vue校园宿舍管理系统
springboot+vue校园宿舍管理系统  功能主要实现校园宿舍的宿舍管理,学生管理,班级管理,宿舍楼管理,以及维修记录管理,晚归管理,请假管理。 同时有一套系统管理,包含用户管理,角色管理,菜单管理,日志管理。
小程序table组件 满足基本需求
小程序table组件 怎么用请参考https://blog.csdn.net/weixin_67585820/article/details/123791822