先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新Python全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Python知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
如果你需要这些资料,可以添加V获取:vip1024c (备注Python)
正文
'user_id':student[0].user_id,
'username': username,
'password': password
}
context = {
'status': username,
'msg': '已登录',
'lenght': 1
}
return render(request, 'studentManage/index.html', context)
else:
context = {
'status': '用户名密码错误!请重新输入!如未注册,请先注册!'
}
return render(request, 'studentManage/login.html', context)
else:
context = {
'status': '请输入用户名和密码',
'length': 0
}
return render(request, 'studentManage/login.html', context)
#注册界面
def regist(request):
if request.method == “POST”:
username = request.POST.get(“username”)
password = request.POST.get(“password”)
verif_password = request.POST.get(“verif_password”)
student = StudentModel.objects.filter(username=username)
# 注册验证错误信息汇总
error_message = “”
if not all([username,password,verif_password]):
error_message+=“注册信息不能为空;\n”
if student:
error_message+=“该用户名已存在;\n”
if password!=verif_password:
error_message+=“两次密码输入不一致;\n”
# 如果存在注册信息则重定向到注册页面
if error_message:
context = {
“error”: error_message
}
return render(request, ‘studentManage/regist.html’, context)
# 注册信息有效,注册成功
stu_data = StudentModel()
stu_data.username = username
stu_data.password = password
stu_data.save()
context = {
'status': '注册成功,请输入用户名密码登录!',
}
return render(request, 'studentManage/login.html', context)
else:
return render(request, 'studentManage/regist.html')
退出界面
def logout(request):
# 注销掉用户,从删除session中保存的信息
del request.session[‘user’]
return render(request, ‘studentManage/index.html’)
增加数据 增加只能root用户或者管理员才能操作
def add(request):
if request.method == “POST”:
root_information = request.session[‘user’]
user_id = root_information[‘user_id’]
root_id = StudentModel.objects.get(pk=user_id).user_id
if user_id == root_id:
stu_id = request.POST.get(‘stu_id’)
stu_name = request.POST.get(‘stu_name’)
if not all([stu_id, stu_name]):
context = {
‘msg’: ‘学号和名字有遗漏’,
}
return render(request, ‘studentManage/add.html’, context)
stu_data = StudentInformationModel()
stu_data.user_id = root_id
stu_data.stu_id = stu_id
stu_data.stu_name = stu_name
stu_data.stu_phone = request.POST.get(‘stu_phone’)
stu_data.stu_address = request.POST.get(‘stu_address’)
stu_data.stu_faculty = request.POST.get(‘stu_faculty’)
stu_data.stu_major = request.POST.get(‘stu_major’)
stu_data.save()
context = {
‘success’: ‘增加成功’,
}
return render(request, ‘studentManage/add.html’, context)
else:
context = {
‘error’: ‘只用root用户和管理员才能操作’
}
return render(request, ‘studentManage/add.html’, context)
else:
return render(request, ‘studentManage/add.html’)
查询
def select(request):
if request.method == “POST”:
stu_id = request.POST.get(‘stu_id’)
# if id==‘’:
# id=request.session[‘user’][‘id’]
try:
stu_data = StudentInformationModel.objects.get(stu_id=stu_id)
# print(stu_data.stu_id, stu_data.stu_name, stu_data.stu_phone, stu_data.stu_address, stu_data.stu_faculty,
# stu_data.stu_major)
except:
context = {
‘error’: "not found studnet id: "+str(stu_id),
}
return render(request, ‘studentManage/select.html’, context)
stu_course = CourseModel.objects.filter(stu_id=stu_id)
dct = {}
for stu in stu_course:
dct[stu.course] = stu.grade
context = {
'stu_id': stu_data.stu_id,
'stu_name': stu_data.stu_name,
'stu_phone': stu_data.stu_phone,
'stu_address': stu_data.stu_address,
'stu_faculty': stu_data.stu_faculty,
'stu_major': stu_data.stu_major,
'course_data': dct,
'msg': True
}
return render(request, 'studentManage/select.html', context)
else:
root_information = request.session['user']
user_id = root_information['user_id']
stu_data = StudentInformationModel.objects.filter(user_id=user_id).first()
context = {
'msg': False,
'stu_id': stu_data.stu_id
}
return render(request, 'studentManage/select.html', context)
删除
def delete(request):
if request.method == “POST”:
try:
id = int(request.POST.get(‘stu_id’))
# StudentInformationModel.objects.filter(stu_id=id).delete()
stu_data = StudentInformationModel.objects.filter(stu_id=id)
if len(stu_data):
stu_data.delete()
context = {
‘msg’: ‘成功删除’
}
return render(request, ‘studentManage/delete.html’, context)
else:
context = {
‘msg’: ‘学生学号输入错误,请确认后重新输入!’
}
return render(request, ‘studentManage/delete.html’, context)
except:
context = {
‘msg’: ‘学生学号输入错误,请确认后重新输入!’
}
return render(request, ‘studentManage/delete.html’, context)
else:
root_information = request.session[‘user’]
user_id = root_information[‘user_id’]
stu_data = StudentInformationModel.objects.filter(user_id=user_id).first()
context = {
‘stu_id’: stu_data.stu_id
}
return render(request, ‘studentManage/delete.html’, context)
修改
def update(request):
user_information = request.session[‘user’]
user_id = user_information[‘user_id’]
stu_data = StudentInformationModel.objects.filter(user_id=user_id).first()
context = {
‘stu_id’: stu_data.stu_id,
‘stu_name’: stu_data.stu_name,
‘stu_phone’: stu_data.stu_phone,
‘stu_address’: stu_data.stu_address,
‘stu_faculty’: stu_data.stu_faculty,
‘stu_major’: stu_data.stu_major,
}
if request.method == “POST”:
stu_id = request.POST.get(‘stu_id’)
stu_name = request.POST.get(‘stu_name’)
stu_phone = request.POST.get(‘stu_phone’)
stu_address = request.POST.get(‘stu_address’)
stu_faculty = request.POST.get(‘stu_faculty’)
stu_major = request.POST.get(‘stu_major’)
# StudentInformationModel.objects.filter(stu_id=id).update(stu_id=stu_id, stu_name=stu_name, stu_phone=stu_phone, stu_address=stu_address, stu_faculty=stu_faculty, stu_major=stu_major)
# 或者 以下这种,对单个数据进行修改
stu_data = StudentInformationModel.objects.get(stu_id=stu_id)
stu_data.stu_id = stu_id
stu_data.stu_name = stu_name
stu_data.stu_phone = stu_phone
stu_data.stu_address = stu_address
stu_data.stu_faculty = stu_faculty
stu_data.stu_major = stu_major
stu_data.save()
context = {
‘stu_id’: stu_id,
‘stu_name’: stu_name,
‘stu_phone’: stu_phone,
‘stu_address’: stu_address,
‘stu_faculty’: stu_faculty,
‘stu_major’: stu_major,
‘msg’: ‘修改成功’
}
return render(request, ‘studentManage/update.html’, context)
else:
return render(request, ‘studentManage/update.html’, context)
**3、urls.py**
from django.urls import path
from studentManagement import views
from django.conf.urls import url
app_name = ‘studentManager’
urlpatterns = [
path(‘’, views.index),
path(‘index/’, views.index, name=‘index’),
path(‘login/’, views.login, name=‘login’),
path(‘regist/’, views.regist, name=‘regist’),
path(‘logout/’, views.logout, name=‘logout’),
path(‘add/’, views.add, name=‘add’),
path(‘select/’, views.select, name=‘select’),
path(‘delete/’, views.delete, name=‘delete’),
path(‘update/’, views.update, name=‘update’)
]
#### 七、数据库
1、学生用户名密码表“new\_student” 主要包括用户id、用户名、密码以及创建时间等
![](https://img-blog.csdnimg.cn/2020102009053015.png)
2、学生信息表“new\_studentinformation” 主要包括用户id、学生id、姓名、电话、地址、院系、专业、创建时间以及修改时间等
![](https://img-blog.csdnimg.cn/20201020090930504.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDU0Nzk5Mw==,size_16,color_FFFFFF,t_70)
3、课程成绩表“new\_course” 主要包括 学生id、课程以及分数
![](https://img-blog.csdnimg.cn/20201020091102867.png)
#### 八、templates静态文件以及目录结构
templates中放置html文件。这里仅仅展示一小部分代码
![](https://img-blog.csdnimg.cn/20201020091354483.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDU0Nzk5Mw==,size_16,color_FFFFFF,t_70)
#### **九、功能展示**
**首页:**
![](https://img-blog.csdnimg.cn/20201020092025572.png)
**登录页:**
![](https://img-blog.csdnimg.cn/20201020092103408.png)
**登录后:**
![](https://img-blog.csdnimg.cn/2020102009213825.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDU0Nzk5Mw==,size_16,color_FFFFFF,t_70)
**添加:**
![](https://img-blog.csdnimg.cn/20201020092417403.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDU0Nzk5Mw==,size_16,color_FFFFFF,t_70)
删除:
![](https://img-blog.csdnimg.cn/20201020092803403.png)
**修改:**
![](https://img-blog.csdnimg.cn/2020102009322157.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDU0Nzk5Mw==,size_16,color_FFFFFF,t_70)
**查询:**
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210511152217670.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3poaWd1aWd1,size_16,color_FFFFFF,t_70)
**感谢每一个认真阅读我文章的人,看着粉丝一路的上涨和关注,礼尚往来总是要有的:**
① 2000多本Python电子书(主流和经典的书籍应该都有了)
② Python标准库资料(最全中文版)
③ 项目源码(四五十个有趣且经典的练手项目及源码)
④ Python基础入门、爬虫、web开发、大数据分析方面的视频(适合小白学习)
⑤ Python学习路线图(告别不入流的学习)
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**需要这份系统化的资料的朋友,可以添加V获取:vip1024c (备注python)**
![img](https://img-blog.csdnimg.cn/img_convert/97f04eecb2cc49e5064172148629e9a1.png)
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
③ 项目源码(四五十个有趣且经典的练手项目及源码)
④ Python基础入门、爬虫、web开发、大数据分析方面的视频(适合小白学习)
⑤ Python学习路线图(告别不入流的学习)
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**需要这份系统化的资料的朋友,可以添加V获取:vip1024c (备注python)**
[外链图片转存中...(img-P550rtd2-1713293730975)]
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**