File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from django .shortcuts import render
2+ from django .views .decorators .csrf import csrf_exempt
23from django .views .decorators .http import require_POST
34from django .views .decorators .cache import never_cache
45from django .http import JsonResponse
56
67from database .models import Attendant
78
89
10+ @csrf_exempt
911@require_POST
1012@never_cache
1113def scanned (request , tag : bytes ):
1214 try :
13- attendant = Attendant .objects .get (tag = tag )
15+ attendant = Attendant .objects .get (nfc_id = tag )
1416 # TODO: Queue event
1517 return JsonResponse ({"valid" : attendant .is_valid }, status = 202 )
1618
1719 except Attendant .DoesNotExist :
18- return JsonResponse ({"error" : "No such tag" }, status = 404 )
20+ return JsonResponse ({"error" : "No such tag" , "valid" : False }, status = 404 )
Original file line number Diff line number Diff line change 2525# SECURITY WARNING: don't run with debug turned on in production!
2626DEBUG = True
2727
28- ALLOWED_HOSTS = []
28+ ALLOWED_HOSTS = ["*" ]
2929
3030
3131# Application definition
You can’t perform that action at this time.
0 commit comments