rename key

This commit is contained in:
Jonathan Baecker 2020-07-29 10:21:38 +02:00
parent 619ecd3e36
commit 1b932dccbf
2 changed files with 4 additions and 5 deletions

View File

@ -58,7 +58,7 @@ def write_json(data):
if os.path.isfile(output) and data == read_json(data['date']): if os.path.isfile(output) and data == read_json(data['date']):
return Response({ return Response({
'text': 'Playlist from {} already exists'.format(data['date']) 'detail': 'Playlist from {} already exists'.format(data['date'])
}, status=status.HTTP_204_NO_CONTENT) }, status=status.HTTP_204_NO_CONTENT)
@ -66,7 +66,7 @@ def write_json(data):
json.dump(data, outfile, indent=4) json.dump(data, outfile, indent=4)
return Response({ return Response({
'text': 'Playlist from {} saved'.format(data['date']) 'detail': 'Playlist from {} saved'.format(data['date'])
}, status=status.HTTP_201_CREATED) }, status=status.HTTP_201_CREATED)

View File

@ -169,10 +169,9 @@ class Playlist(APIView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
if 'data' in request.data: if 'data' in request.data:
_respose = write_json(request.data['data']) return write_json(request.data['data'])
return _respose
return Response({'text': 'Unspecified save error'}, return Response({'detail': 'Unspecified save error'},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)