rename key
This commit is contained in:
parent
619ecd3e36
commit
1b932dccbf
@ -58,7 +58,7 @@ def write_json(data):
|
||||
|
||||
if os.path.isfile(output) and data == read_json(data['date']):
|
||||
return Response({
|
||||
'text': 'Playlist from {} already exists'.format(data['date'])
|
||||
'detail': 'Playlist from {} already exists'.format(data['date'])
|
||||
}, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ def write_json(data):
|
||||
json.dump(data, outfile, indent=4)
|
||||
|
||||
return Response({
|
||||
'text': 'Playlist from {} saved'.format(data['date'])
|
||||
'detail': 'Playlist from {} saved'.format(data['date'])
|
||||
}, status=status.HTTP_201_CREATED)
|
||||
|
||||
|
||||
|
@ -169,10 +169,9 @@ class Playlist(APIView):
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
if 'data' in request.data:
|
||||
_respose = write_json(request.data['data'])
|
||||
return _respose
|
||||
return write_json(request.data['data'])
|
||||
|
||||
return Response({'text': 'Unspecified save error'},
|
||||
return Response({'detail': 'Unspecified save error'},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user