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)
def logs_api_details(request,pk,format=None): logs = changelog.objects.filter(id=pk) serializer = logSerializer(logs, many=True) return Response(serializer.data)
def get_log(request): rooms = log.objects.all() serializer = logSerializer(rooms, many=True) return Response(serializer.data)