Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2020-08-05 21:28:36 +02:00
parent f56e989ed4
commit 421bc95917

View File

@@ -113,7 +113,7 @@ def strokedatajson_v2(request,id):
if request.method == 'POST': if request.method == 'POST':
checkdata, r = dataprep.getrowdata_db(id=row.id) checkdata, r = dataprep.getrowdata_db(id=row.id)
if not checkdata.empty: if not checkdata.empty:
return HttpResponse("Duplicate Error",status=403) return HttpResponse("Duplicate Error",status=409)
df = pd.DataFrame() df = pd.DataFrame()
@@ -295,6 +295,7 @@ def strokedatajson_v2(request,id):
@csrf_exempt @csrf_exempt
@login_required() @login_required()
@api_view(['GET','POST']) @api_view(['GET','POST'])
@permission_classes([IsAuthenticated])
def strokedatajson(request,id): def strokedatajson(request,id):
""" """
POST: Add Stroke data to workout POST: Add Stroke data to workout
@@ -307,7 +308,7 @@ def strokedatajson(request,id):
try: try:
id = int(id) id = int(id)
except ValueError: except ValueError:
return HttpResponse("Not a valid workout number",status=400) return HttpResponse("Not a valid workout number",status=403)
if request.method == 'GET': if request.method == 'GET':
@@ -326,7 +327,7 @@ def strokedatajson(request,id):
# strokedata = request.POST['strokedata'] # strokedata = request.POST['strokedata']
# checking/validating and cleaning # checking/validating and cleaning
try: try:
strokedata = json.loads(request.POST['strokedata']) strokedata = json.loads(request.data['strokedata'])
except: except:
return HttpResponse("No JSON object could be decoded",status=400) return HttpResponse("No JSON object could be decoded",status=400)