|
|
|
@ -11,6 +11,7 @@ from django.views.decorators.cache import cache_page |
|
|
|
|
from django_filters.rest_framework import DjangoFilterBackend |
|
|
|
|
from django.core.cache import cache |
|
|
|
|
from update.utils.get_version import GetVersion |
|
|
|
|
from rest_framework.decorators import action |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# CacheResponseMixin 一定要放第一位 |
|
|
|
@ -32,6 +33,14 @@ class CinemaViewSet(CacheResponseMixin, viewsets.ModelViewSet): |
|
|
|
|
filterset_fields = ('ip',) |
|
|
|
|
GetVersion().main_process() |
|
|
|
|
|
|
|
|
|
@action(methods=['get'], detail=False) |
|
|
|
|
def refresh(self, request, *args, **kwargs): |
|
|
|
|
GetVersion().main_process() |
|
|
|
|
queryset = Cinema.objects.all() |
|
|
|
|
serializer = self.get_serializer(instance=queryset, many=True) |
|
|
|
|
return Response(serializer.data) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# class CinemaSearchAPIView(APIView, CacheResponseMixin): |
|
|
|
|
# @method_decorator(cache_page(60 * 5)) |
|
|
|
|
# def get(self, request, *args, **kwargs): |
|
|
|
|