# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.template import Context
from django.shortcuts import render_to_response
from book.models import Person
from datetime import datetime
# Create your views here.
def hello(request):
return HttpResponse("Hello Django")
def time(request):
now = datetime.now()
return HttpResponse(now)
def time1(request):
now = datetime.now()
c = Context({'time':now})
return render_to_response('time.html',c)
def check(dic,lst):
for i in lst:
if not i in dic:
return False
return True
lst = ['qq','name','add','tel','stu','email','bir']
flag=True
def search_form(request):
return render_to_response('search_form.html')
def search(request):
error = False
if 'q' in request.GET :
q = request.GET['q']
if not q:
error = True
return render_to_response('search_form.html',{'error': error})
else:
query_list = Person.objects.filter(name=q)
if not query_list:
return render_to_response('search_form.html',{'error': error})
else:
return render_to_response ('search_results_.html',{'query_list':query_list})
else:
error = True
return render_to_response('search_form.html', {'error': error})
def post(request):
if request.GET:
l = request.GET
ADD = Person(name=l['name'],
student_number=l['stu'],
address=l['add'],
email=l['email'],
QQ=l['qq'],
birthday=l['bir'],
telephone=l['tel'])
ADD.save()
return render_to_response('choose.html',{'right':True})
else:
return render_to_response('post1.html',{'right':True})
def delete(request):
id1 = request.GET["id"]
Person.objects.filter(id=id1).delete()
all_objects = Person.objects.all()
return render_to_response('view_all.html',{'all_objects':all_objects})
def change(request):
global flag,people
if flag:
id1 = request.GET["id"]
people = Person.objects.get(id=id1)
flag=False
return render_to_response('change1.html',{'people':people})
else:
l = request.GET
people.name = l['name']
people.student_number=l['stu']
people.address=l['add']
people.email=l['email']
people.QQ=l['qq']
people.birthday=l['bir']
people.telephone=l['tel']
people.save()
flag=True
return render_to_response('choose.html',{'right':True})
def bg(request):
return render_to_response("bground.html")
def view_all(request):
all_objects = Person.objects.all()
return render_to_response('view_all.html',{'all_objects':all_objects})
qq_21900783
- 粉丝: 0
- 资源: 3
最新资源
- 对通信原理的内容的matlab实现.zip
- 多变量数据相空间重构参数估计的MATLAB代码.zip
- 对同步采集的三个信号PPGECGBP进行特征提取的matlab程序.zip
- 多目标优化的MATLAB工具.zip
- 得一微EMMC规格书 SILICONGO SGM800C
- 多维扩散MRI的MATLAB代码.zip
- PCemV17 Win版+ROM
- 多输出高斯过程在MATLAB中包括潜在力模型.zip
- 仿真具有信道丢失指向误差的自由空间光学FSO通信系统,并与所有解析解进行比较,给出了完整的MATLAB代码.zip
- 二维和三维弹塑性有限元矩阵的MATLAB快速装配.zip
- 范德比尔特大学的Coursera课程《MATLAB编程入门》.zip
- 符号电路的MATLAB分析.zip
- 非刚性迭代最近点nricp.zip
- 该MATLAB包实现了Christopher Diehl和Gert Cauwenberghs在SVM增量学习自适应与优.zip
- 该存储库包含FPGAHDL演示若干波束形成和雷达设计,提供了Simulink模型和MATLAB参考代码来展示各种雷达和.zip
- 该工具箱包括MATLAB脚本,用于执行皮层表面图之间解剖对应关系的旋转测试,如关于人脑结构和功能图之间空间对应关系的测.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈