【发布时间】:2017-03-05 06:37:32
【问题描述】:
是否可以将服务器响应代码添加到 JsonResponse ?在某些情况下,我需要服务器回复 404。
我有以下看法
def CreateOrAuth(request):
try:
username = request.POST.get("username")
queryset = User.objects.get(username=username)
except Exception as e:
return JsonResponse({'status': 'user with {} not exist'.format(username)})
我想在这里添加404服务器代码
【问题讨论】:
标签: django