2023-09-12 19:51:06 +08:00
|
|
|
from django.utils.decorators import method_decorator
|
|
|
|
from django.views.decorators.cache import cache_page
|
2023-07-10 17:06:43 +08:00
|
|
|
from rest_framework import generics
|
|
|
|
from rest_framework.permissions import IsAuthenticated
|
|
|
|
from .serializers import LandmarkSerializer
|
2023-07-11 15:03:42 +08:00
|
|
|
from .models import Landmark
|
2023-07-10 17:06:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
class LandmarkListView(generics.ListAPIView):
|
|
|
|
serializer_class = LandmarkSerializer
|
2023-07-11 15:03:42 +08:00
|
|
|
# permission_classes = [IsAuthenticated]
|
|
|
|
queryset = Landmark.objects.all()
|
2023-09-12 19:51:06 +08:00
|
|
|
|
|
|
|
@method_decorator(cache_page(60*60))
|
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
|
return super().dispatch(*args, **kwargs)
|