from rest_framework import viewsets

from books.models import BookPage
from books.serializers import BookPageSerializer


class BookPageViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows BookPages to be viewed or edited.
    """
    queryset = BookPage.objects.all()
    serializer_class = BookPageSerializer

from rest_framework import viewsets

from books.models import BookPage
from books.serializers import BookPageSerializer


class BookPageViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows BookPages to be viewed or edited.
    """
    queryset = BookPage.objects.order_by('page_number')
    serializer_class = BookPageSerializer

Order book pages by page number.
Order book pages by page number.

  from rest_framework import viewsets
  
  from books.models import BookPage
  from books.serializers import BookPageSerializer
  
  
  class BookPageViewSet(viewsets.ModelViewSet):
      """
      API endpoint that allows BookPages to be viewed or edited.
      """
-     queryset = BookPage.objects.all()
+     queryset = BookPage.objects.order_by('page_number')
      serializer_class = BookPageSerializer
  
Order book pages by page number.
## Code Before:
from rest_framework import viewsets

from books.models import BookPage
from books.serializers import BookPageSerializer


class BookPageViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows BookPages to be viewed or edited.
    """
    queryset = BookPage.objects.all()
    serializer_class = BookPageSerializer

## Instruction:
Order book pages by page number.
## Code After:
from rest_framework import viewsets

from books.models import BookPage
from books.serializers import BookPageSerializer


class BookPageViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows BookPages to be viewed or edited.
    """
    queryset = BookPage.objects.order_by('page_number')
    serializer_class = BookPageSerializer
