
from django.shortcuts import render
from django.utils import timezone
# API v1
from rest_framework import mixins, viewsets
from rest_framework.permissions import AllowAny

from apps.careeropportunity.models import CareerOpportunity
from apps.careeropportunity.serializers import CareerSerializer


def index(request, id=None):
    return render(request, 'careeropportunity/index.html')


class CareerViewSet(viewsets.GenericViewSet, mixins.RetrieveModelMixin, mixins.ListModelMixin):
    """
    Viewset for Career serializer
    """

    queryset = CareerOpportunity.objects.filter(
        start__lte=timezone.now(),
        end__gte=timezone.now()
    ).order_by('-featured', '-start')
    serializer_class = CareerSerializer
    permission_classes = (AllowAny,)


from django.shortcuts import render
from django.utils import timezone
# API v1
from rest_framework import mixins, viewsets
from rest_framework.permissions import AllowAny
from rest_framework.pagination import PageNumberPagination

from apps.careeropportunity.models import CareerOpportunity
from apps.careeropportunity.serializers import CareerSerializer


def index(request, id=None):
    return render(request, 'careeropportunity/index.html')


class HundredItemsPaginator(PageNumberPagination):
    page_size = 100


class CareerViewSet(viewsets.GenericViewSet, mixins.RetrieveModelMixin, mixins.ListModelMixin):
    """
    Viewset for Career serializer
    """

    queryset = CareerOpportunity.objects.filter(
        start__lte=timezone.now(),
        end__gte=timezone.now()
    ).order_by('-featured', '-start')
    serializer_class = CareerSerializer
    permission_classes = (AllowAny,)
    pagination_class = HundredItemsPaginator

Increase pagination size for careeropportunity api
Increase pagination size for careeropportunity api

  
  from django.shortcuts import render
  from django.utils import timezone
  # API v1
  from rest_framework import mixins, viewsets
  from rest_framework.permissions import AllowAny
+ from rest_framework.pagination import PageNumberPagination
  
  from apps.careeropportunity.models import CareerOpportunity
  from apps.careeropportunity.serializers import CareerSerializer
  
  
  def index(request, id=None):
      return render(request, 'careeropportunity/index.html')
+ 
+ 
+ class HundredItemsPaginator(PageNumberPagination):
+     page_size = 100
  
  
  class CareerViewSet(viewsets.GenericViewSet, mixins.RetrieveModelMixin, mixins.ListModelMixin):
      """
      Viewset for Career serializer
      """
  
      queryset = CareerOpportunity.objects.filter(
          start__lte=timezone.now(),
          end__gte=timezone.now()
      ).order_by('-featured', '-start')
      serializer_class = CareerSerializer
      permission_classes = (AllowAny,)
+     pagination_class = HundredItemsPaginator
  
Increase pagination size for careeropportunity api
## Code Before:

from django.shortcuts import render
from django.utils import timezone
# API v1
from rest_framework import mixins, viewsets
from rest_framework.permissions import AllowAny

from apps.careeropportunity.models import CareerOpportunity
from apps.careeropportunity.serializers import CareerSerializer


def index(request, id=None):
    return render(request, 'careeropportunity/index.html')


class CareerViewSet(viewsets.GenericViewSet, mixins.RetrieveModelMixin, mixins.ListModelMixin):
    """
    Viewset for Career serializer
    """

    queryset = CareerOpportunity.objects.filter(
        start__lte=timezone.now(),
        end__gte=timezone.now()
    ).order_by('-featured', '-start')
    serializer_class = CareerSerializer
    permission_classes = (AllowAny,)

## Instruction:
Increase pagination size for careeropportunity api
## Code After:

from django.shortcuts import render
from django.utils import timezone
# API v1
from rest_framework import mixins, viewsets
from rest_framework.permissions import AllowAny
from rest_framework.pagination import PageNumberPagination

from apps.careeropportunity.models import CareerOpportunity
from apps.careeropportunity.serializers import CareerSerializer


def index(request, id=None):
    return render(request, 'careeropportunity/index.html')


class HundredItemsPaginator(PageNumberPagination):
    page_size = 100


class CareerViewSet(viewsets.GenericViewSet, mixins.RetrieveModelMixin, mixins.ListModelMixin):
    """
    Viewset for Career serializer
    """

    queryset = CareerOpportunity.objects.filter(
        start__lte=timezone.now(),
        end__gte=timezone.now()
    ).order_by('-featured', '-start')
    serializer_class = CareerSerializer
    permission_classes = (AllowAny,)
    pagination_class = HundredItemsPaginator
