from rest_framework.views import APIView from rest_framework.generics import GenericAPIView from rest_framework.response import Response from .models import PlatIOTCardInfo # Create your views here. class GetBaseType(APIView): def get(self, request): queryset = PlatIOTCardInfo.objects.raw("SELECT id,device_type FROM IOTCard_platiotcardinfo GROUP BY device_type;") data = [] for i in queryset: data.append(i.device_type) return Response(data)