1👍
✅
try to apply this:
@api_view(['GET'])
def getOneSet(request, var1):
proa = ProA.objects.filter(var1=var1)
serializer = ProASerializer(proa, many=True)
return Response(serializer.data)
@api_view(['DELETE'])
def deleteOneSet(request, var1):
data = ProA.objects.filter(var1=var1)
if data:
data.delete()
return Response({'message': 'Data was deleted successfully!'}, status=status.HTTP_204_NO_CONTENT)
return Response({'message': 'The var1 value does not exist'}, status=status.HTTP_404_NOT_FOUND)
Source:stackexchange.com