<reponame>lahnstrom/url_shortener<gh_stars>0
from rest_framework import viewsets, mixins

from .models import Link
from .serializers import LinkSerializer


class LinkViewSet(mixins.CreateModelMixin,
                  mixins.RetrieveModelMixin,
                  mixins.ListModelMixin,
                  mixins.DestroyModelMixin,
                  viewsets.GenericViewSet):
    """
    API endpoint that allows links to be listed, created and deleted.
    """
    queryset = Link.objects.order_by('-created_at').all()
    serializer_class = LinkSerializer
    lookup_field = 'uuid'

from rest_framework import viewsets, mixins

from .models import Link
from .serializers import LinkSerializer


class LinkViewSet(mixins.CreateModelMixin,
                  mixins.RetrieveModelMixin,
                  mixins.ListModelMixin,
                  mixins.DestroyModelMixin,
                  viewsets.GenericViewSet):
    """
    API endpoint that allows links to be listed, created and deleted.
    """
    queryset = Link.objects.order_by('-created_at').all()
    serializer_class = LinkSerializer
    lookup_field = 'uuid'
API endpoint that allows links to be listed, created and deleted.