Created
February 4, 2016 17:57
-
-
Save NekoTashi/5395da4bf6bf78b30d06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import filters | |
from rest_framework import pagination | |
from rest_framework import mixins | |
from rest_framework.authentication import TokenAuthentication | |
from rest_framework.authentication import SessionAuthentication | |
from .permissions import IsAuthorized | |
from .filters import ExampleFilter | |
class ExampleView(mixins.CreateModelMixin, | |
mixins.ListModelMixin, | |
mixins.UpdateModelMixin, | |
mixins.DestroyModelMixin, | |
viewsets.GenericViewSet): | |
authentication_classes = (TokenAuthentication, SessionAuthentication,) | |
permission_classes = (IsAuthorized, ) | |
serializer_class = ExampleSerializer | |
queryset = Example.objects.all() | |
filter_backends = (filters.DjangoFilterBackend, ) | |
filter_class = ExampleFilter | |
pagination_class = pagination.PageNumberPagination | |
paginate_by = 20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment