File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,3 +13,17 @@ class ProjectNewsPagination(pagination.LimitOffsetPagination):
1313 default_limit = 5
1414 limit_query_param = "limit"
1515 offset_query_param = "offset"
16+
17+
18+ class ProjectsPagination (pagination .LimitOffsetPagination ):
19+ """
20+ Pagination for Users
21+
22+ For example:
23+ /projects/?limit=10&offset=10
24+ gets the next 10 news after the first 10 news.
25+ """
26+
27+ default_limit = 10
28+ limit_query_param = "limit"
29+ offset_query_param = "offset"
Original file line number Diff line number Diff line change 1818 update_partner_program ,
1919)
2020from projects .models import Project , Achievement , ProjectNews
21- from projects .pagination import ProjectNewsPagination
21+ from projects .pagination import ProjectNewsPagination , ProjectsPagination
2222from projects .permissions import (
2323 IsProjectLeaderOrReadOnlyForNonDrafts ,
2424 HasInvolvementInProjectOrReadOnly ,
@@ -48,6 +48,7 @@ class ProjectList(generics.ListCreateAPIView):
4848 permission_classes = [IsAuthenticated , permissions .IsAuthenticatedOrReadOnly ]
4949 filter_backends = (filters .DjangoFilterBackend ,)
5050 filterset_class = ProjectFilter
51+ pagination_class = ProjectsPagination
5152
5253 def create (self , request , * args , ** kwargs ):
5354 serializer = self .get_serializer (data = request .data )
You can’t perform that action at this time.
0 commit comments