python+django+sql学生信息管理后台开发-创新互联
一、功能
成都创新互联公司"三网合一"的企业建站思路。企业可建设拥有电脑版、微信版、手机版的企业网站。实现跨屏营销,产品发布一步更新,电脑网络+移动网络一网打尽,满足企业的营销需求!成都创新互联公司具备承接各种类型的网站建设、成都网站设计项目的能力。经过10余年的努力的开拓,为不同行业的企事业单位提供了优质的服务,并获得了客户的一致好评。实现对学生对个人信息的增删查改
实现后台对所有学生信息的操作
二、平台
windows+pycharm(python开发工具)
三、逻辑框图
四、代码展示
此后台采用的是MVC的风格模式进行编码
1.VIEWS部分
def hello(request):#功能选择 # t = loader.get_template("hello.html") # c = RequestContext(request) return render_to_response("hello.html",context_instance=RequestContext(request)) def addstu(request):# 添加学生信息 name = request.POST.get("name") age = request.POST.get("age") learn = request.POST.get("learn") newstu = Student(name=name,age=age,learn=learn) newstu.save() # c = RequestContext(request) # t = loader.get_template("check.html") return render_to_response("done.html",context_instance=RequestContext(request,{"age":age,"learn":learn,"name":name})) def checkstu(request):#查询学生信息 find = [] stulist = Student.objects.all() name = request.POST.get("name") age = request.POST.get("age") learn = request.POST.get("learn") if name: find = Student.objects.filter(name__contains=name) elif age: find = Student.objects.filter(age=age) elif age: find = Student.objects.filter(learn__contains=learn) return render_to_response("check.html",context_instance=RequestContext(request,{"stulist":stulist,"find":find})) def putmessage(request):#信息提交中转 return render_to_response("add.html",context_instance=RequestContext(request)) def deletStu(request):#删除学生信息 alert="" name = request.POST.get("name") age = request.POST.get("age") learn = request.POST.get("learn") delet = request.POST.get("delet") find = Student.objects.filter(name__contains =name) if not find: alert = u"没有找到名为" + name + u"的学生" elif not delet: elert="" else: find.delete() alert = u"成功删除该学生" return render_to_response("delet.html",context_instance=RequestContext(request,{"alert":alert,"student":find})) def putmessage2(request):#信息提交中转2 return render_to_response("put2.html",context_instance=RequestContext(request)) def rewrite(request):#学生信息更改 aler=u"提示:" stulist = Student.objects.all() message = request.POST.get("message") old = request.POST.get("old") new = request.POST.get("new") if old == "name": student= Student.objects.filter( name__contains = message).update(name = new) aler+=u"信息修改成功" elif old== "age": student= Student.objects.filter( name__contains = message).update(age = new) aler+=u"信息修改成功" elif old =="learn": student= Student.objects.filter( name__contains = message).update(learn = new) aler+=u"信息修改成功" else: aler+=u"请输入正确的需要修改的信息类别(name,age或learn)" return render_to_response("show.html",context_instance=RequestContext(request,{"id":id,"message":message,"new":new,"stulist":stulist,"aler":aler}))
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前名称:python+django+sql学生信息管理后台开发-创新互联
浏览路径:http://pwwzsj.com/article/djhisd.html