django 序列化
程序员文章站
2022-03-03 10:20:29
...
from django.core import serializers
@csrf_exempt
def query_time(request):
start = request.POST.get('start')#a.get('username')
end = request.POST.get('end')#a.get('password')
start=datetime.date(int(start[6:10]),int(start[0:2]),int(start[3:5]))
end = datetime.date(int(end[6:10]),int(end[0:2]),int(end[3:5]))
# datetime.date(2020, 1, 1)
data=Water.objects.filter(c_time__range=(start,end))
data= serializers.serialize('json', data)
# data = json.dumps(list(data))
# print(data)
return JsonResponse(data, safe=False)
上一篇: 长江水文代码
下一篇: 根据电话号码获取归属地