| 1 |
from rest_framework import viewsets |
| 2 |
|
| 3 |
from .pagination import WithMaxPagination, FixedPagination, FlexiblePagination |
| 4 |
from .models import CommentForPaginateByMaxMixin |
| 5 |
from .serializers import CommentSerializer |
| 6 |
|
| 7 |
|
| 8 |
class CommentViewSet(viewsets.ReadOnlyModelViewSet): |
| 9 |
serializer_class = CommentSerializer |
| 10 |
pagination_class = WithMaxPagination |
| 11 |
queryset = CommentForPaginateByMaxMixin.objects.all().order_by('id') |
| 12 |
|
| 13 |
|
| 14 |
class CommentWithoutPaginateByParamViewSet(viewsets.ReadOnlyModelViewSet): |
| 15 |
serializer_class = CommentSerializer |
| 16 |
pagination_class = FixedPagination |
| 17 |
queryset = CommentForPaginateByMaxMixin.objects.all() |
| 18 |
|
| 19 |
|
| 20 |
class CommentWithoutMaxPaginateByAttributeViewSet(viewsets.ReadOnlyModelViewSet): |
| 21 |
pagination_class = FlexiblePagination |
| 22 |
serializer_class = CommentSerializer |
| 23 |
queryset = CommentForPaginateByMaxMixin.objects.all() |