一、from-data数据获取与返回
from django.http import JsonResponse
from test_test.models import Event
from django.core.exceptions import ValidationError,ObjectDoesNotExist
def add_event(request):
#获取接口请求参数
eid = request.POST.get("eid","")
name = request.POST.get("name","")
limit = request.POST.get("limit","")
status = request.POST.get("status","")
address = request.POST.get("address","")
start_time = request.POST.get("start_time","")
#参数校验
if eid =='' or name == '' or limit == '' or address == '' or start_time == '':
print eid
print name
print address
print limit
print start_time
return JsonResponse({'status':10021,'message':'parameter error kokokokkokok'
django入门指南(二)Python django 后端接口
最新推荐文章于 2024-06-05 17:18:30 发布