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