本功能主要是简单的签到功能,签到时间为获取系统时间。
@csrf_exempt
def qiandao(request): #签到view页面
if request.method == 'GET':
return render(request, 'qiandao.html')
else:
qid=request.session['uid'] #签到人的工号
qname = request.POST.get('qname', '')
qtime = timezone.now()
conn = MySQLdb.connect("localhost", "root", "7378", "test")
with conn.cursor(cursorclass=MySQLdb.cursors.DictCursor) as cursor:
cursor.execute("INSERT INTO thanks_qd (qid,qname,qtime) "
"values (%s,%s,%s)",[qid, qname,qtime])
conn.commit()
return redirect('../qiandao/')
@csrf_exempt
def qiantui(request): #签退view页面
if request.method == 'GET':
return render(request, 'qiantui.html')
else:
qid=request.session['uid'] #请假人的工号
q_time2 = timezone.now()
conn = MySQLdb.connect("localhost","root","7378","test")
with conn.cursor