prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Searching in photos api is broken
  ### Describe the bug
  Searching in photos api is broken
  
  ### How to reproduce
  Steps to reproduce the behaviour:
  1. Go to https://thalia.nu/api/v1/photos/albums/?search=Test
  
  ### Expected behaviour
  This should not crash.
  
  
  
  </issue>
  <code>
  [start of website/photos/api/viewsets.py]
  1 from rest_framework import permissions, filters
  2 from rest_framework.exceptions import PermissionDenied
  3 from rest_framework.mixins import CreateModelMixin, UpdateModelMixin
  4 from rest_framework.viewsets import ModelViewSet, GenericViewSet
  5 
  6 from photos import services
  7 from photos.api import serializers
  8 from photos.models import Album, Photo
  9 
  10 
  11 class AlbumsViewSet(ModelViewSet):
  12     """ViewSet class for an Album object."""
  13 
  14     permission_classes = (permissions.IsAuthenticated,)
  15     queryset = Album.objects.all()
  16     filter_backends = (filters.SearchFilter,)
  17     search_fields = ("title_en", "title_nl", "date", "slug")
  18 
  19     def get_queryset(self):
  20         """Return albums that are annotated to be accessible by the request user."""
  21         return services.get_annotated_accessible_albums(
  22             self.request, Album.objects.all()
  23         )
  24 
  25     def create(self, request, *args, **kwargs):
  26         """Create album if the request user is allowed to."""
  27         if self.request.user.has_perm("photos.create_album"):
  28             return super().create(request, *args, **kwargs)
  29         raise PermissionDenied
  30 
  31     def update(self, request, *args, **kwargs):
  32         """Create album if the request user is allowed to."""
  33         if self.request.user.has_perm("photos.change_album"):
  34             return super().update(request, *args, **kwargs)
  35         raise PermissionDenied
  36 
  37     def get_serializer_class(self):
  38         """Return AlbumListSerializer if the current action is list else return AlbumSerializer."""
  39         if self.action == "list":
  40             return serializers.AlbumListSerializer
  41         return serializers.AlbumSerializer
  42 
  43 
  44 class PhotosViewSet(GenericViewSet, CreateModelMixin, UpdateModelMixin):
  45     """ViewSet class for a Photo object."""
  46 
  47     queryset = Photo.objects.all()
  48     permission_classes = (permissions.IsAuthenticated,)
  49     serializer_class = serializers.PhotoCreateSerializer
  50 
  51     def create(self, request, *args, **kwargs):
  52         """Create photo if the request user is allowed to."""
  53         if self.request.user.has_perm("photos.create_photo"):
  54             return super().create(request, *args, **kwargs)
  55         raise PermissionDenied
  56 
  57     def update(self, request, *args, **kwargs):
  58         """Update photo if the request user is allowed to."""
  59         if self.request.user.has_perm("photos.change_photo"):
  60             return super().update(request, *args, **kwargs)
  61         raise PermissionDenied
  62
  [end of website/photos/api/viewsets.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/website/photos/api/viewsets.py b/website/photos/api/viewsets.py
  --- a/website/photos/api/viewsets.py
  +++ b/website/photos/api/viewsets.py
  @@ -14,7 +14,7 @@
       permission_classes = (permissions.IsAuthenticated,)
       queryset = Album.objects.all()
       filter_backends = (filters.SearchFilter,)
  -    search_fields = ("title_en", "title_nl", "date", "slug")
  +    search_fields = ("title_en", "date", "slug")
   
       def get_queryset(self):
           """Return albums that are annotated to be accessible by the request user."""
  
verification_info: {"golden_diff": "diff --git a/website/photos/api/viewsets.py b/website/photos/api/viewsets.py\n--- a/website/photos/api/viewsets.py\n+++ b/website/photos/api/viewsets.py\n@@ -14,7 +14,7 @@\n     permission_classes = (permissions.IsAuthenticated,)\n     queryset = Album.objects.all()\n     filter_backends = (filters.SearchFilter,)\n-    search_fields = (\"title_en\", \"title_nl\", \"date\", \"slug\")\n+    search_fields = (\"title_en\", \"date\", \"slug\")\n \n     def get_queryset(self):\n         \"\"\"Return albums that are annotated to be accessible by the request user.\"\"\"\n", "issue": "Searching in photos api is broken\n### Describe the bug\r\nSearching in photos api is broken\r\n\r\n### How to reproduce\r\nSteps to reproduce the behaviour:\r\n1. Go to https://thalia.nu/api/v1/photos/albums/?search=Test\r\n\r\n### Expected behaviour\r\nThis should not crash.\r\n\r\n\n", "before_files": [{"content": "from rest_framework import permissions, filters\nfrom rest_framework.exceptions import PermissionDenied\nfrom rest_framework.mixins import CreateModelMixin, UpdateModelMixin\nfrom rest_framework.viewsets import ModelViewSet, GenericViewSet\n\nfrom photos import services\nfrom photos.api import serializers\nfrom photos.models import Album, Photo\n\n\nclass AlbumsViewSet(ModelViewSet):\n    \"\"\"ViewSet class for an Album object.\"\"\"\n\n    permission_classes = (permissions.IsAuthenticated,)\n    queryset = Album.objects.all()\n    filter_backends = (filters.SearchFilter,)\n    search_fields = (\"title_en\", \"title_nl\", \"date\", \"slug\")\n\n    def get_queryset(self):\n        \"\"\"Return albums that are annotated to be accessible by the request user.\"\"\"\n        return services.get_annotated_accessible_albums(\n            self.request, Album.objects.all()\n        )\n\n    def create(self, request, *args, **kwargs):\n        \"\"\"Create album if the request user is allowed to.\"\"\"\n        if self.request.user.has_perm(\"photos.create_album\"):\n            return super().create(request, *args, **kwargs)\n        raise PermissionDenied\n\n    def update(self, request, *args, **kwargs):\n        \"\"\"Create album if the request user is allowed to.\"\"\"\n        if self.request.user.has_perm(\"photos.change_album\"):\n            return super().update(request, *args, **kwargs)\n        raise PermissionDenied\n\n    def get_serializer_class(self):\n        \"\"\"Return AlbumListSerializer if the current action is list else return AlbumSerializer.\"\"\"\n        if self.action == \"list\":\n            return serializers.AlbumListSerializer\n        return serializers.AlbumSerializer\n\n\nclass PhotosViewSet(GenericViewSet, CreateModelMixin, UpdateModelMixin):\n    \"\"\"ViewSet class for a Photo object.\"\"\"\n\n    queryset = Photo.objects.all()\n    permission_classes = (permissions.IsAuthenticated,)\n    serializer_class = serializers.PhotoCreateSerializer\n\n    def create(self, request, *args, **kwargs):\n        \"\"\"Create photo if the request user is allowed to.\"\"\"\n        if self.request.user.has_perm(\"photos.create_photo\"):\n            return super().create(request, *args, **kwargs)\n        raise PermissionDenied\n\n    def update(self, request, *args, **kwargs):\n        \"\"\"Update photo if the request user is allowed to.\"\"\"\n        if self.request.user.has_perm(\"photos.change_photo\"):\n            return super().update(request, *args, **kwargs)\n        raise PermissionDenied\n", "path": "website/photos/api/viewsets.py"}]}