目 录
1 引言 1
1.1课题背景 1
1.2选题意义 1
2 系统可行性分析 1
2.1 技术可行性分析 1
2.2 经济可行性分析 1
2.3 操作可行性分析 2
3系统分析 2
3.1 系统功能分析 2
3.1.1 管理员模块 2
3.1.2 用户模块 3
3.1.3 后厨模块 4
3.2 系统业务流程分析 4
3.3 系统数据流程分析 5
3.4 数据字典 6
4 系统设计 9
4.1 功能结构设计 9
4.2 数据库设计 9
4.2.1 数据库概念结构设计 9
4.2.2 将E-R图转换为关系模型 11
4.3.3 关系模式的规范化 12
4.3.4 数据库表设计 13
4.3.5 数据库表中约束设计 15
5 系统实现 16
5.1 顾客页面实现 16
5.2 后厨页面实现 18
5.3 管理员页面实现 19
6 总结 22
参考文献 24
2 系统可行性分析
2.1 技术可行性分析
点菜信息管理系统将Sqlite作为数据库,Sqlite作为开源的关系型数据库,并且具有成本低、体积小、速度快等特点。整个系统是基于Django框架搭建的,Django框架本身就已经拥有了很多基础性的功能,不需要再去重复的完成大量的编码工作,提高了程序的规范性和代码的重用性。采用Bootstrap4 + jQuery作为前端的技术支持,后台使用Python面向对象语言。由此可见,实现点菜信息管理系统在技术上是完全可行的,并且可以完成点菜信息管理系统所需要的基本功能。
2.2 经济可行性分析
从目前的社会现状来看传统的点菜模式不仅浪费时间,效率低下,而且特别耗费成本与人力。于此不同,使用点菜信息管理系统能大大降低人力的成本这样就节省了相对应的成本开销,避免人员的冗余,并且开发系统使用的工具和技术都是开源的,投入该系统的成本并不高。所以对于餐馆来说开发一个点菜信息管理系统在当前的资金投入和使用该系统降低的成本上是可以接受的,由此来看此系统从经济上来看是可行的。
2.3 操作可行性分析
该系统使用的技术都是目前大众普遍使用的,并且操作简单,业务逻辑流程条例清晰,使用方便,并且用户使用起来上手快,容易理解,不需要理解太深的东西。由此来看,该系统从操作上来看是可行的。
3系统分析
3.1 系统功能分析
该系统为点菜管理信息系统。网上点菜系统是一种可以自主选择、个性化、便捷化、特色化的点餐模式,它的大力推广使用为餐厅节约了成本,同时也解决了消费者在传统点菜时存在的不少麻烦。通过对系统的需求进行分析得出,该系统的功能模块分为三种,分别是管理员模块、用户模块、后厨模块,并且各个用户模块下对应着各自的功能实现。
3.1.1 管理员模块
(1)管理员登录:对于已经存在管理员可进行登录。
(2)订单信息查询:管理员可以查询系统内所有存在订单。
(3)职工信息管理:管理员可以登录该系统对已经注册的职工个人信息进行增加、删除、改动、查找等操作。
(4)餐桌信息管理:管理员可以对该系统对已经存在的餐桌信息进行增加、删除、改动、查找等操作。本文转载自http://www.biyezuopin.vip/onews.asp?id=15595
(5)菜品信息管理:管理员可以对该系统对已经存在的菜品信息进行增加、删除、改动、查找等操作。
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import Food, Foodtype, Order, OrderItem, Staff, Staff_Table
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.db import connection
from . import forms
import json
import datetime
#
@csrf_exempt
def OrderHome(request):
if request.method == "GET":
foodList = Food.objects.all()
foodTypeList = Foodtype.objects.all()
tableList = Staff_Table.objects.all()
return render(
request,
'OrderHome.html',
{
'foodList': foodList,
'foodTypeList': foodTypeList,
'tableList': tableList,
}
)
elif request.method == "POST":
foodList = json.loads(request.POST.get('foodList'))
table_id = request.POST.get('table')
# 创建订单 填写基本信息
new_order = Order(table_id=table_id, is_pay=False)
staff_in_charge = Staff_Table.objects.get(pk=table_id).staff
new_order.staff = staff_in_charge # 当前桌子的负责人
new_order.save()
# 先 save 再获取 ID
order_id = new_order.ID
food_amount = 0
total_price = 0
for food in foodList:
curFood = Food.objects.get(pk=food['id'])
price = curFood.price
sum_price = price * food['amount']
curFood.amount -= food['amount']
curFood.save()
food_amount += food['amount']
total_price += sum_price
OrderItem.objects.create(
orderID=new_order,
foodID=curFood,
amount=food['amount'],
sum_price=sum_price
)
# 订单的物品总数、总价
new_order.food_amount = food_amount
new_order.total_price = total_price
new_order.save()
return HttpResponse(json.dumps({
'order_id': order_id
}))
# 账单详情页
def QueryOrder(request, order_id):
try:
order = Order.objects.get(pk=order_id)
except:
return HttpResponse('无此订单!')
foodList = Food.objects.filter(orderitem__orderID__ID=order_id)
with connection.cursor() as cursor:
SELECT_COL = 'OrderSystem_food.ID ID, OrderSystem_food.title title, OrderSystem_orderitem.amount amount'
SELECT_COL += ', OrderSystem_orderitem.sum_price '
SELECT_COL += ', OrderSystem_orderitem.start_cook_time '
SELECT_COL += ', OrderSystem_orderitem.end_cook_time '
SELECT_FROM = 'OrderSystem_food, OrderSystem_orderitem '
SELECT_WHERE = 'OrderSystem_food.ID=OrderSystem_orderitem.foodID_id '
SELECT_WHERE += ' and OrderSystem_orderitem.orderID_id={0}'.format(
order_id)
cursor.execute(
f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}')
foodJsonList = dictfetchall(cursor)#封装成字典
return render(request, 'QueryOrder.html', {
'order': order,
'foodList': foodJsonList,
})
# 待结账页面
def CheckUnpaidOrder(request):
# 查询当前未结账订单
orderList = []
with connection.cursor() as cursor:
SELECT_COL = 'ID, create_time, table_id, total_price'
SELECT_FROM = 'OrderSystem_order'
SELECT_WHERE = 'is_pay=0' # 0 false
SELECT = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
cursor.execute(SELECT)
orderList = dictfetchall(cursor)
print(orderList)
return render(request, 'CheckUnpaidOrder.html', {
'orderList': orderList,
})
# 结账
@csrf_exempt
def CheckOut(request):
if request.method == "POST":
order_list = json.loads(request.POST.get('order_list'))
print(order_list)
for order_data in order_list:
print(order_data)
order_id = order_data['order_id']
is_pay = order_data['is_pay']
if is_pay:
order = Order.objects.get(pk=order_id)
if order.is_pay == True:
print("已经支付!")
return HttpResponse(json.dumps({
'status': 'ALREADY_PAY'
}))
order.is_pay = True
order.pay_time = datetime.datetime.now()
order.save()
else:
return HttpResponse(json.dumps({
'status': 'NO_PAY'
}))
return HttpResponse(json.dumps({
'status': 'OK'
}))
@login_required
def manage(request):
staffList = Staff.objects.all()
# (餐桌号 + 餐桌名字 + 负责人ID + 负责人姓名)
tableInfoList = []
with connection.cursor() as cursor:
SELECT_COL = ' distinct {0}_staff_table.ID table_id '#桌子id
SELECT_COL += ', {0}_staff_table.name table_name '#桌子名字
SELECT_COL += ', {0}_staff.ID staff_id '
SELECT_COL += ', {0}_staff.name staff_name '
SELECT_COL = SELECT_COL.format('OrderSystem')
SELECT_FROM = '{0}_staff_table, {0}_staff '
SELECT_FROM = SELECT_FROM.format('OrderSystem')
SELECT_WHERE = '{0}_staff.ID = {0}_staff_table.staff_id '
SELECT_WHERE = SELECT_WHERE.format('OrderSystem')
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
cursor.execute(SELECT_SQL)
tableInfoList = dictfetchall(cursor)
return render(request, 'manage.html', {
'tableInfoList': tableInfoList,
'staffList': staffList,
'user':request.user,
})
@csrf_exempt
def getServingTableList(request):
# (餐桌号 + 餐桌名字 + 负责人ID + 负责人姓名)
servingTableList = []
with connection.cursor() as cursor:
SELECT_COL = 'distinct {0}_order.table_id table_id '
SELECT_COL = SELECT_COL.format('OrderSystem')
SELECT_FROM = '{0}_order '
SELECT_FROM = SELECT_FROM.format('OrderSystem')
SELECT_WHERE = '{0}_order.is_pay = 0 ' # false 0
SELECT_WHERE = SELECT_WHERE.format('OrderSystem')
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
SELECT_SQL += 'order by table_id'
cursor.execute(SELECT_SQL)
servingTableInfoList = dictfetchall(cursor)
for tableInfo in servingTableInfoList:
servingTableList.append(tableInfo['table_id'])
return HttpResponse(json.dumps({
'servingTableList': servingTableList,
}))
@csrf_exempt
def getOrderItemList(request):
if request.method == "POST":
# 没有指定 order_id 就返回所有 order_item
order_id = request.POST.get('order_id')
with connection.cursor() as cursor:
SELECT_COL = '{0}orderitem.orderID_id order_id '
SELECT_COL += ',{0}order.table_id table_id '
SELECT_COL += ',{0}orderitem.foodID_id food_id '
SELECT_COL += ',{0}food.title food_name '
SELECT_COL += ',{0}orderitem.amount food_amount '
SELECT_COL += ',{0}orderitem.status status '
SELECT_COL = SELECT_COL.format('OrderSystem_')
SELECT_FROM = '{0}orderitem, {0}food, {0}order '
SELECT_FROM = SELECT_FROM.format('OrderSystem_')
SELECT_WHERE = 'food_id = {0}food.ID '
SELECT_WHERE += ' and {0}order.ID = order_id '
SELECT_WHERE += ' and {0}order.is_pay = 0 '
SELECT_WHERE += (' and order_id=' +
order_id) if order_id != None else ''
SELECT_WHERE = SELECT_WHERE.format('OrderSystem_')
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
SELECT_SQL += 'order by table_id'
cursor.execute(SELECT_SQL)
orderItemList = dictfetchall(cursor)
return HttpResponse(json.dumps(orderItemList))
# 更新餐桌表 中的 staff
@csrf_exempt
def set_staff_charge_table(request):
if request.method == "POST":
table_id = request.POST.get("table_id")
staff_id = request.POST.get("staff_id")
try:
Staff_Table.objects.filter(pk=table_id).update(staff_id=staff_id)
return HttpResponse(json.dumps({
'status': "OK"
}))
except:
return HttpResponse(json.dumps({
'status': "FAIL"
}))
# 上菜
@csrf_exempt
def delive_food(request):
if request.method == "POST":
order_id = request.POST.get("order_id")
food_id = request.POST.get("food_id")
OrderItem.objects.filter(
orderID_id=order_id, foodID_id=food_id).update(status=3)
try:
return HttpResponse(json.dumps({
'status': "OK"
}))
except:
return HttpResponse(json.dumps({
'status': "FAIL"
}))
# 后厨
@login_required#标识一个视图可以被跨域访问
def food_supplier(request):
return render(request, 'FoodSupplier.html')
# 后厨接口 接单or完成
@csrf_exempt
def cook(request):
if request.method == "POST":
OP = request.POST.get("OP")
order_id = request.POST.get("order_id")
food_id = request.POST.get("food_id")
orderItem = OrderItem.objects.filter(
orderID_id=order_id, foodID_id=food_id)
target_status = 1 if OP == "take_order" else 2
if(OP == "take_order"):
orderItem.update(status=1)
orderItem.update(start_cook_time=datetime.datetime.now())
else:
orderItem.update(status=2)
orderItem.update(end_cook_time=datetime.datetime.now())
orderItem.save()
return HttpResponse(json.dumps({
'status': 'OK',
}))
def dictfetchall(cursor):
'''辅助函数 数据库查询结果转换成 json/dict'''
columns = [col[0] for col in cursor.description]
return [
dict(zip(columns, row))
for row in cursor.fetchall()
]
###############################################################
#
# 管理
#
###############################################################
def orders(request):
orders = Order.objects.all()
return render(request, 'manage/orders.html', {
'orders': orders,
})
@csrf_exempt
def staffs(request):
if request.method=="GET":
form = forms.StaffForm()
staffs = Staff.objects.all()
return render(request, 'manage/staffs.html', {
'form': form,
'staffs': staffs,
})
elif request.method == "POST":
name=request.POST.get('name')
SELECT_COL = '*'
SELECT_FROM='OrderSystem_staff'
SELECT_WHERE='OrderSystem_staff.name like'+ "'%"+name+ "%'"
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
print(SELECT_SQL,"SQL")
with connection.cursor() as cursor:
cursor.execute(SELECT_SQL)
staffs = dictfetchall(cursor)
print(staffs, "SQL_res")
form = forms.StaffForm()
#staffs = Staff.objects.all()
return render(request, 'manage/staffs.html', {
'form': form,
'staffs': staffs,
})
# form_back = forms.StaffForm(request.POST)
# if form_back.is_valid():
# form_back.save()
# return HttpResponse(json.dumps({
# 'status': 'OK',
# }))
# else:
# print(form_back.errors.as_data())
# print(form_back.errors.as_json())
# print(form_back.errors.as_text())
# print(form_back.errors.as_ul())
# return HttpResponse(json.dumps({
# 'status': 'FAIL',
# }))
@csrf_exempt
def tables(request):
print(request.body)
print(request.method,"method")
if request.method == "GET":
form = forms.Staff_TableForm()
with connection.cursor() as cursor:
SELECT_COL = ' distinct {0}_staff_table.ID table_id '
SELECT_COL += ', {0}_staff_table.name table_name '
SELECT_COL += ', {0}_staff.ID staff_id '
SELECT_COL += ', {0}_staff.name staff_name '
SELECT_COL = SELECT_COL.format('OrderSystem')
SELECT_FROM = '{0}_staff_table, {0}_staff '
SELECT_FROM = SELECT_FROM.format('OrderSystem')
SELECT_WHERE = '{0}_staff.ID = {0}_staff_table.staff_id '
SELECT_WHERE = SELECT_WHERE.format('OrderSystem')
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
cursor.execute(SELECT_SQL)
tables = dictfetchall(cursor)
#print(tables,"table")
with connection.cursor() as cursor:
cursor.execute(
'select ID staff_id, name staff_name from OrderSystem_staff;')
staffs = dictfetchall(cursor)
print('GET')
#print(staffs,"staffs")
return render(request, 'manage/tables.html', {
'form': form,
'tables': tables,
'staffs': staffs,
})
else:
name = request.POST.get('table_name')
with connection.cursor() as cursor:
SELECT_COL = ' distinct {0}_staff_table.ID table_id '
SELECT_COL += ', {0}_staff_table.name table_name '
SELECT_COL += ', {0}_staff.ID staff_id '
SELECT_COL += ', {0}_staff.name staff_name '
SELECT_COL = SELECT_COL.format('OrderSystem')
SELECT_FROM = '{0}_staff_table, {0}_staff '
SELECT_FROM = SELECT_FROM.format('OrderSystem')
SELECT_WHERE = '{0}_staff.ID = {0}_staff_table.staff_id AND {0}_staff_table.name like '
SELECT_WHERE += "'%"+name+ "%'"
SELECT_WHERE = SELECT_WHERE.format('OrderSystem')
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
cursor.execute(SELECT_SQL)
print(SELECT_SQL, "SQL")
tables = dictfetchall(cursor)
print(tables, "SQL_res")
form = forms.Staff_TableForm()
# staffs = Staff.objects.all()
return render(request, 'manage/tables.html', {
'form': form,
'tables': tables,
# 'staffs': staffs,
})
@csrf_exempt
def add_tables(request):
if request.method == 'GET':
form = forms.Staff_TableForm()
table=Staff_Table.objects.all()
return render(request,'manage/add_tables.html',{
'form': form,
})
else:
form_back = forms.Staff_TableForm(request.POST)
if form_back.is_valid():
data = form_back.cleaned_data
form_back.save()
print("OK")
return redirect('/manage/tables')
else:
print(form_back.errors.as_data())
print(form_back.errors.as_json())
print(form_back.errors.as_text())
print(form_back.errors.as_ul())
return HttpResponse(json.dumps({
'Fail To Add': 'The table number already exists, please modify it',
}),)
def update_tables(request):
if request.method == 'GET':
form = forms.Staff_TableForm()
ID = request.GET.get('id')
tables_obj = Staff_Table.objects.get(ID=ID)
return render(request, 'manage/update_tables.html', {
'form': form,
'table': tables_obj
})
else:
ID = request.POST.get('ID')
print(ID,'ID')
table_obj = Staff_Table.objects.get(ID=ID)
table_obj_all = Staff_Table.objects.all()
table_obj.ID = request.POST.get('ID')
table_obj.name = request.POST.get('name')
table_obj.staff_id = request.POST.get('staff')
table_obj.save()
return redirect('/manage/tables')
@csrf_exempt
def foods(request):
if request.method == "GET":
foods = Food.objects.all()
food_types = Foodtype.objects.all()
food_form = forms.FoodForm()
food_type_form = forms.FoodtypeForm()
return render(request, 'manage/foods.html', {
'food_form': food_form,
'food_type_form': food_type_form,
'foods': foods,
'food_types': food_types,
})
elif request.method == "POST":
try:
name = request.POST.get('foods_name')
SELECT_COL = '*'
SELECT_FROM = 'OrderSystem_food'
SELECT_WHERE = 'OrderSystem_food.title like ' + "'%"+name+ "%'"
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
food_types = Foodtype.objects.all()
print(SELECT_SQL, "SQL")
with connection.cursor() as cursor:
cursor.execute(SELECT_SQL)
foods = dictfetchall(cursor)
except:
name=request.POST.get('foods_type_name')
SELECT_COL = '*'
SELECT_FROM = 'OrderSystem_foodtype'
SELECT_WHERE = 'OrderSystem_foodtype.name like' + "'%"+name+ "%'"
SELECT_SQL = f'select {SELECT_COL} from {SELECT_FROM} where {SELECT_WHERE}'
foods = Food.objects.all()
print(SELECT_SQL, "SQL")
with connection.cursor() as cursor:
cursor.execute(SELECT_SQL)
food_types = dictfetchall(cursor)
print(foods, "SQL_res")
food_form = forms.FoodForm()
food_type_form=forms.FoodtypeForm
# staffs = Staff.objects.all()
return render(request, 'manage/foods.html', {
'food_form': food_form,
'food_type_form': food_type_form,
'foods': foods,
'food_types': food_types,
})
@csrf_exempt
def add_foodtype(request):
if request.method == 'GET':
food_type_form = forms.FoodtypeForm
return render(request,'manage/add_foodtype.html',{
'food_type_form': food_type_form,
})
else:
form_foodtype = forms.FoodtypeForm(request.POST)
if form_foodtype.is_valid():
data = form_foodtype.cleaned_data
form_foodtype.save()
return redirect('/manage/foods')
def update_foodtype(request):
if request.method == 'GET':
food_type_form = forms.FoodtypeForm
ID = request.GET.get('id')
foodtype_obj = Foodtype.objects.get(ID=ID)
return render(request,'manage/update_foodtype.html',{
'food_type_form': food_type_form,
'foodtype_obj':foodtype_obj
})
else:
ID = request.POST.get('ID')
foodtype_obj = Foodtype.objects.get(ID=ID)
foodtype_obj.name=request.POST.get('name')
foodtype_obj.save()
return redirect('/manage/foods')
@csrf_exempt
def update_foods(request):
if request.method == 'GET':
ID = request.GET.get('id')
food_form = forms.FoodForm()
foods_obj = Food.objects.get(ID=ID)
return render(request, 'manage/update_foods.html', {
'foods_obj': foods_obj,
'food_form': food_form,
})
else:
ID = request.POST.get('ID')
foods_obj = Food.objects.get(ID=ID)
foods_obj.title = request.POST.get("title")
foods_obj.amount = request.POST.get("amount")
foods_obj.price = request.POST.get("price")
foods_obj.cost_time = request.POST.get("cost_time")
foods_obj.foodType_id = request.POST.get("foodType")
foods_obj.save()
return redirect('/manage/foods')
def add_foods(request):
if request.method == 'GET':
food_form = forms.FoodForm()
return render(request, 'manage/add_foods.html', {
'food_form': food_form,
})
else:
form_food = forms.FoodForm(request.POST)
if form_food.is_valid():
data = form_food.cleaned_data
form_food.save()
return redirect('/manage/foods')
@csrf_exempt
#员工 增加
def add_staffs(request):
if request.method=="GET":
return render(request,'manage/add_staffs.html')
elif request.method == "POST":
form_back = forms.StaffForm(request.POST)
import re
# print(,"phone")
#print(form_back,"citizenID")
ret = re.match(r"^1[35678]\d{9}$", form_back.data['phone'])
if ret:
print("匹配成功")
r = r'^([1-9]\d{5}[12]\d{3}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])\d{3}[0-9xX])$'
ret = re.match(r, form_back.data['citizenID'])
if ret:
if form_back.is_valid():
form_back.save()
form = forms.StaffForm()
staffs = Staff.objects.all()
return render(request, 'manage/staffs.html', {
'form': form,
'staffs': staffs,
})
else:
print(form_back.errors.as_data())
print(form_back.errors.as_json())
print(form_back.errors.as_text())
print(form_back.errors.as_ul())
return HttpResponse(json.dumps({
'status': 'FAIL',
}))
else:
return HttpResponse(json.dumps({
'citizenID': 'error!',
}))
else:
return HttpResponse(json.dumps({
'phone': 'error!',
}))
@csrf_exempt
#员工 删除
def dark(request):
if request.method == "POST":
target = request.POST
table = target['table']
SQL = ''
if target['double'] == 'false':
ID = target['id']
SQL += f'delete from OrderSystem_{table} where ID={ID}'
elif target['double'] == 'true':
foodID_id = target['foodID_id']
orderID_id = target['orderID_id']
SQL += f'delete from OrderSystem_{table} where foodID_id={foodID_id} and orderID_id={orderID_id}'
print('========================================================================')
print(SQL)
print('========================================================================')
try:
with connection.cursor() as cursor:
cursor.execute(SQL)
print("True")
return HttpResponse(json.dumps({
'status': 'OK',
}))
# return render(request, 'manage/staffs.html', {
# 'status': json.dumps([1,1])
# })
except:
print("False")
# return render(request, 'manage/staffs.html', {
# 'status': json.dumps([0,0])
# })
return HttpResponse(json.dumps({
'status': 'FAIL',
}))
#员工更新
@csrf_exempt
def update_staffs(request):
if request.method=='GET':
ID=request.GET.get('id')
staffs_obj=Staff.objects.get(ID=ID)
return render(request, 'manage/update_staffs.html', {
'staffs': staffs_obj,
})
else :
ID=request.POST.get('ID')
citizenID=request.POST.get('citizenID')
name = request.POST.get('name')
gender = request.POST.get('gender')
born_date = request.POST.get('born_date')
phone = request.POST.get('phone')
address = request.POST.get('address')
staff_obj=Staff.objects.get(ID=ID)
staff_obj.name=name
staff_obj.citizenID = citizenID
staff_obj.gender = gender
staff_obj.born_date = born_date
staff_obj.phone = phone
staff_obj.address = address
import re
# print(,"phone")
# print(form_back,"citizenID")
ret = re.match(r"^1[35678]\d{9}$", phone)
if ret:
print("匹配成功")
r = r'^([1-9]\d{5}[12]\d{3}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])\d{3}[0-9xX])$'
ret = re.match(r, citizenID)
if ret:
staff_obj.save()
return redirect('/manage/staffs')
else:
return HttpResponse(json.dumps({
'citizenID': 'error!',
}))
else:
return HttpResponse(json.dumps({
'phone': 'error!',
}))
# staffs = dictfetchall(cursor)
#return render(request, 'manage/update_staffs.html')
#return render(request,'update_staffs.html')