old_contents: from django.utils.decorators import method_decorator
  from django.views.decorators.cache import cache_page
  from django_filters.rest_framework import DjangoFilterBackend
  from rest_framework import viewsets, mixins, routers
  from rest_framework.filters import SearchFilter, OrderingFilter
  from rest_framework.viewsets import GenericViewSet
  from taggit.models import Tag
  
  from core import serializers as api
  from core.models import Image, Pin, Board
  from core.permissions import IsOwnerOrReadOnly
  
  
  class ImageViewSet(mixins.CreateModelMixin, GenericViewSet):
      queryset = Image.objects.all()
      serializer_class = api.ImageSerializer
  
      def create(self, request, *args, **kwargs):
          return super(ImageViewSet, self).create(request, *args, **kwargs)
  
  
  class PinViewSet(viewsets.ModelViewSet):
      queryset = Pin.objects.all().select_related('image', 'submitter')
      serializer_class = api.PinSerializer
      filter_backends = (DjangoFilterBackend, SearchFilter, OrderingFilter)
      filter_fields = ("submitter__username", 'tags__name', )
      ordering_fields = ('-id', )
      ordering = ('-id', )
      permission_classes = [IsOwnerOrReadOnly("submitter"), ]
  
  
  class BoardViewSet(viewsets.ModelViewSet):
      queryset = Board.objects.all()
      serializer_class = api.BoardSerializer
      filter_backends = (DjangoFilterBackend, OrderingFilter)
      filter_fields = ("submitter__username", )
      ordering_fields = ('-id', )
      ordering = ('-id', )
      permission_classes = [IsOwnerOrReadOnly("submitter"), ]
  
  
  class BoardAutoCompleteViewSet(
      mixins.ListModelMixin,
      viewsets.GenericViewSet,
  ):
      queryset = Board.objects.all()
      serializer_class = api.BoardAutoCompleteSerializer
      filter_backends = (DjangoFilterBackend, OrderingFilter)
      filter_fields = ("submitter__username", )
      ordering_fields = ('-id', )
      ordering = ('-id', )
      pagination_class = None
  
  
  class TagAutoCompleteViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
      queryset = Tag.objects.all()
      serializer_class = api.TagAutoCompleteSerializer
      pagination_class = None
  
      @method_decorator(cache_page(60*5))
      def list(self, request, *args, **kwargs):
          return super(TagAutoCompleteViewSet, self).list(
              request,
              *args,
              **kwargs
          )
  
  
  drf_router = routers.DefaultRouter()
  drf_router.register(r'pins', PinViewSet)
  drf_router.register(r'images', ImageViewSet)
  drf_router.register(r'boards', BoardViewSet)
  drf_router.register(r'tags-auto-complete/', TagAutoCompleteViewSet)
  drf_router.register(r'boards-auto-complete', BoardAutoCompleteViewSet)
  
new_contents: from django.utils.decorators import method_decorator
  from django.views.decorators.cache import cache_page
  from django_filters.rest_framework import DjangoFilterBackend
  from rest_framework import viewsets, mixins, routers
  from rest_framework.filters import SearchFilter, OrderingFilter
  from rest_framework.viewsets import GenericViewSet
  from taggit.models import Tag
  
  from core import serializers as api
  from core.models import Image, Pin, Board
  from core.permissions import IsOwnerOrReadOnly
  
  
  class ImageViewSet(mixins.CreateModelMixin, GenericViewSet):
      queryset = Image.objects.all()
      serializer_class = api.ImageSerializer
  
      def create(self, request, *args, **kwargs):
          return super(ImageViewSet, self).create(request, *args, **kwargs)
  
  
  class PinViewSet(viewsets.ModelViewSet):
      queryset = Pin.objects.all().select_related('image', 'submitter')
      serializer_class = api.PinSerializer
      filter_backends = (DjangoFilterBackend, SearchFilter, OrderingFilter)
      filter_fields = ("submitter__username", 'tags__name', )
      ordering_fields = ('-id', )
      ordering = ('-id', )
      permission_classes = [IsOwnerOrReadOnly("submitter"), ]
  
  
  class BoardViewSet(viewsets.ModelViewSet):
      queryset = Board.objects.all()
      serializer_class = api.BoardSerializer
      filter_backends = (DjangoFilterBackend, OrderingFilter)
      filter_fields = ("submitter__username", )
      ordering_fields = ('-id', )
      ordering = ('-id', )
      permission_classes = [IsOwnerOrReadOnly("submitter"), ]
  
  
  class BoardAutoCompleteViewSet(
      mixins.ListModelMixin,
      viewsets.GenericViewSet,
  ):
      queryset = Board.objects.all()
      serializer_class = api.BoardAutoCompleteSerializer
      filter_backends = (DjangoFilterBackend, OrderingFilter)
      filter_fields = ("submitter__username", )
      ordering_fields = ('-id', )
      ordering = ('-id', )
      pagination_class = None
  
  
  class TagAutoCompleteViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
      queryset = Tag.objects.all()
      serializer_class = api.TagAutoCompleteSerializer
      pagination_class = None
  
      @method_decorator(cache_page(60*5))
      def list(self, request, *args, **kwargs):
          return super(TagAutoCompleteViewSet, self).list(
              request,
              *args,
              **kwargs
          )
  
  
  drf_router = routers.DefaultRouter()
  drf_router.register(r'pins', PinViewSet)
  drf_router.register(r'images', ImageViewSet)
  drf_router.register(r'boards', BoardViewSet)
  drf_router.register(r'tags-auto-complete', TagAutoCompleteViewSet)
  drf_router.register(r'boards-auto-complete', BoardAutoCompleteViewSet)
  
subject: Fix path error for tag-auto-complete api