示例#1
0
文件: views.py 项目: looprock/ipmgr
def logs_api(request):
        if request.method == 'GET':
                logs = changelog.objects.all()
                serializer = logSerializer(logs, many=True)
                return Response(serializer.data)
        elif request.method == 'POST':
                serializer = logSerializer(data=request.DATA)
                if serializer.is_valid():
                        serializer.save()
			#notify(request.DATA)
                        return Response(serializer.data, status=status.HTTP_201_CREATED)
                else:
                        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
示例#2
0
文件: views.py 项目: looprock/ipmgr
def logs_api_details(request,pk,format=None):
        logs = changelog.objects.filter(id=pk)
        serializer = logSerializer(logs, many=True)
        return Response(serializer.data)
示例#3
0
def get_log(request):
    rooms = log.objects.all()
    serializer = logSerializer(rooms, many=True)
    return Response(serializer.data)