prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Pagination of the project list
  When fetching projects in the project list page, is it intentional that all projects are fetched at once even though there is pagination?
  
  Endpoint of project list fetching: `/v1/projects`
  
  When there are a lot of projects, it takes a long time to display them.
  
  Your Environment
  ---------
  doccano v1.5.5
  
  </issue>
  <code>
  [start of backend/api/views/project.py]
  1 from django.conf import settings
  2 from rest_framework import generics, status
  3 from rest_framework.permissions import IsAdminUser, IsAuthenticated
  4 from rest_framework.response import Response
  5 
  6 from members.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly
  7 
  8 from ..models import Project
  9 from ..serializers import ProjectPolymorphicSerializer
  10 
  11 
  12 class ProjectList(generics.ListCreateAPIView):
  13     serializer_class = ProjectPolymorphicSerializer
  14     pagination_class = None
  15 
  16     def get_permissions(self):
  17         if self.request.method == 'GET':
  18             self.permission_classes = [IsAuthenticated, ]
  19         else:
  20             self.permission_classes = [IsAuthenticated & IsAdminUser]
  21         return super().get_permissions()
  22 
  23     def get_queryset(self):
  24         return Project.objects.filter(role_mappings__user=self.request.user)
  25 
  26     def perform_create(self, serializer):
  27         serializer.save(created_by=self.request.user)
  28 
  29     def delete(self, request, *args, **kwargs):
  30         delete_ids = request.data['ids']
  31         projects = Project.objects.filter(
  32             role_mappings__user=self.request.user,
  33             role_mappings__role__name=settings.ROLE_PROJECT_ADMIN,
  34             pk__in=delete_ids
  35         )
  36         # Todo: I want to use bulk delete.
  37         # But it causes the constraint error.
  38         # See https://github.com/django-polymorphic/django-polymorphic/issues/229
  39         for project in projects:
  40             project.delete()
  41         return Response(status=status.HTTP_204_NO_CONTENT)
  42 
  43 
  44 class ProjectDetail(generics.RetrieveUpdateDestroyAPIView):
  45     queryset = Project.objects.all()
  46     serializer_class = ProjectPolymorphicSerializer
  47     lookup_url_kwarg = 'project_id'
  48     permission_classes = [IsAuthenticated & (IsProjectAdmin | IsProjectStaffAndReadOnly)]
  49
  [end of backend/api/views/project.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/backend/api/views/project.py b/backend/api/views/project.py
  --- a/backend/api/views/project.py
  +++ b/backend/api/views/project.py
  @@ -1,5 +1,6 @@
   from django.conf import settings
  -from rest_framework import generics, status
  +from django_filters.rest_framework import DjangoFilterBackend
  +from rest_framework import filters, generics, status
   from rest_framework.permissions import IsAdminUser, IsAuthenticated
   from rest_framework.response import Response
   
  @@ -11,7 +12,8 @@
   
   class ProjectList(generics.ListCreateAPIView):
       serializer_class = ProjectPolymorphicSerializer
  -    pagination_class = None
  +    filter_backends = (DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter)
  +    search_fields = ('name', 'description')
   
       def get_permissions(self):
           if self.request.method == 'GET':
  
verification_info: {"golden_diff": "diff --git a/backend/api/views/project.py b/backend/api/views/project.py\n--- a/backend/api/views/project.py\n+++ b/backend/api/views/project.py\n@@ -1,5 +1,6 @@\n from django.conf import settings\n-from rest_framework import generics, status\n+from django_filters.rest_framework import DjangoFilterBackend\n+from rest_framework import filters, generics, status\n from rest_framework.permissions import IsAdminUser, IsAuthenticated\n from rest_framework.response import Response\n \n@@ -11,7 +12,8 @@\n \n class ProjectList(generics.ListCreateAPIView):\n     serializer_class = ProjectPolymorphicSerializer\n-    pagination_class = None\n+    filter_backends = (DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter)\n+    search_fields = ('name', 'description')\n \n     def get_permissions(self):\n         if self.request.method == 'GET':\n", "issue": "Pagination of the project list\nWhen fetching projects in the project list page, is it intentional that all projects are fetched at once even though there is pagination?\r\n\r\nEndpoint of project list fetching: `/v1/projects`\r\n\r\nWhen there are a lot of projects, it takes a long time to display them.\r\n\r\nYour Environment\r\n---------\r\ndoccano v1.5.5\n", "before_files": [{"content": "from django.conf import settings\nfrom rest_framework import generics, status\nfrom rest_framework.permissions import IsAdminUser, IsAuthenticated\nfrom rest_framework.response import Response\n\nfrom members.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly\n\nfrom ..models import Project\nfrom ..serializers import ProjectPolymorphicSerializer\n\n\nclass ProjectList(generics.ListCreateAPIView):\n    serializer_class = ProjectPolymorphicSerializer\n    pagination_class = None\n\n    def get_permissions(self):\n        if self.request.method == 'GET':\n            self.permission_classes = [IsAuthenticated, ]\n        else:\n            self.permission_classes = [IsAuthenticated & IsAdminUser]\n        return super().get_permissions()\n\n    def get_queryset(self):\n        return Project.objects.filter(role_mappings__user=self.request.user)\n\n    def perform_create(self, serializer):\n        serializer.save(created_by=self.request.user)\n\n    def delete(self, request, *args, **kwargs):\n        delete_ids = request.data['ids']\n        projects = Project.objects.filter(\n            role_mappings__user=self.request.user,\n            role_mappings__role__name=settings.ROLE_PROJECT_ADMIN,\n            pk__in=delete_ids\n        )\n        # Todo: I want to use bulk delete.\n        # But it causes the constraint error.\n        # See https://github.com/django-polymorphic/django-polymorphic/issues/229\n        for project in projects:\n            project.delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n\n\nclass ProjectDetail(generics.RetrieveUpdateDestroyAPIView):\n    queryset = Project.objects.all()\n    serializer_class = ProjectPolymorphicSerializer\n    lookup_url_kwarg = 'project_id'\n    permission_classes = [IsAuthenticated & (IsProjectAdmin | IsProjectStaffAndReadOnly)]\n", "path": "backend/api/views/project.py"}]}