1
0
mirror of https://github.com/daniviga/bite.git synced 2024-11-27 07:16:12 +01:00
bite/freedcs/api/views.py

23 lines
760 B
Python
Raw Normal View History

2020-06-02 00:57:20 +02:00
from rest_framework.viewsets import ModelViewSet
from api.models import Device
from api.serializers import DeviceSerializer
class APISubscribe(ModelViewSet):
queryset = Device.objects.all()
serializer_class = DeviceSerializer
# def post(self, request):
# serializer = DeviceSerializer(data=request.data)
# if serializer.is_valid():
# serializer.save()
# return Response(serializer.data, status=status.HTTP_201_CREATED)
# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
# def get(self, request):
# devices = Device.objects.all()
# import pdb; pdb.set_trace()
# serializer = DeviceSerializer(devices)
# return Response(serializer.serial)