You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
46 lines
1.5 KiB
from django_filters.rest_framework import DjangoFilterBackend |
|
from rest_framework import filters |
|
from rest_framework import viewsets |
|
|
|
from dspt_api.models import EcChannel, EcEnv, EcApi, EcApiParams, EcCinemaIds, EcRequestLog, EcApiGroup |
|
from dspt_api.serializers import EcChannelSerializer, EcEnvSerializer, EcApiSerializer, EcApiParamsSerializer, \ |
|
EcCinemaIdsSerializer, EcRequestLogSerializer, EcApiGroupSerializer |
|
|
|
|
|
# Create your views here. |
|
class EcChannelViewSet(viewsets.ModelViewSet): |
|
queryset = EcChannel.objects.all() |
|
serializer_class = EcChannelSerializer |
|
|
|
|
|
class EcEnvViewSet(viewsets.ModelViewSet): |
|
queryset = EcEnv.objects.all() |
|
serializer_class = EcEnvSerializer |
|
|
|
|
|
class EcApiViewSet(viewsets.ModelViewSet): |
|
queryset = EcApi.objects.all() |
|
serializer_class = EcApiSerializer |
|
|
|
|
|
class EcApiParamsViewSet(viewsets.ModelViewSet): |
|
queryset = EcApiParams.objects.all() |
|
serializer_class = EcApiParamsSerializer |
|
filter_backends = (filters.SearchFilter, DjangoFilterBackend) |
|
# http://172.16.1.114:8000/ec/get_api_params?api_id=1 |
|
filterset_fields = ('api_id',) |
|
|
|
|
|
class EcCinemaIdsViewSet(viewsets.ModelViewSet): |
|
queryset = EcCinemaIds |
|
serializer_class = EcCinemaIdsSerializer |
|
|
|
|
|
class EcRequestLogViewSet(viewsets.ModelViewSet): |
|
queryset = EcRequestLog.objects.all() |
|
serializer_class = EcRequestLogSerializer |
|
|
|
|
|
class EcApiGroupViewSet(viewsets.ModelViewSet): |
|
queryset = EcApiGroup.objects.all() |
|
serializer_class = EcApiGroupSerializer
|
|
|