zmz 6 months ago
parent f8a7e2b4c6
commit 04330ac974

@ -18,13 +18,13 @@ class CustomerLoginView(View):
id = request.POST.get('id', "")
customer_name = request.POST.get('customer_name', "")
# print(id, customer_name)
# customer_list = customer.objects.filter(id=id, customer_name=customer_name)
customer_list = customer.objects.filter(id=id, customer_name=customer_name)
# print(customer_list)
# if customer_list:
# print(type(customer_list[0]))
# request.session.clear()
# request.session['customer'] = customer_list[0].id
if id == '1' and customer_name == '张三':
if customer_list:
print(type(customer_list[0]))
request.session.clear()
request.session['customer'] = customer_list[0].id
# if id == '1' and customer_name == '张三':
request.session['customer'] = '1'
return HttpResponseRedirect('/customercenter/')
else:
@ -40,14 +40,14 @@ class EmployeeLoginView(View):
def post(self,request):
id = request.POST.get('id',"")
password = request.POST.get('password',"")
# employee_list =employee.objects.filter(id=id,password=password)
# if employee_list:
# request.session['employee'] = employee_list[0].name
employee_list =employee.objects.filter(id=id,password=password)
if employee_list:
request.session['employee'] = employee_list[0].id
# request.session['employee_image'] = str(employee_list[0].img)
# return HttpResponseRedirect('/employeecenter/')
if id == '1' and password == '123':
request.session['employee'] = '123'
return HttpResponseRedirect('/employeecenter/')
# if id == '1' and password == '123':
# request.session['employee'] = '123'
# return HttpResponseRedirect('/employeecenter/')
else:
return HttpResponseRedirect('/Employee_login/')

Loading…
Cancel
Save