prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Include Example number in the Project Comments view
  Feature description
  ---------
  On the backend API and in the dataset annotation interface, the Comments are associated with specific Examples. But in the Project Comments view, the Example association is unclear--all the comments are grouped together.
  
  Can the Project Comments view tab be improved to detail Examples, maybe even sort or group by Example?
  
  Thanks!
  
  </issue>
  <code>
  [start of backend/examples/views/comment.py]
  1 from django_filters.rest_framework import DjangoFilterBackend
  2 from rest_framework import filters, generics, status
  3 from rest_framework.permissions import IsAuthenticated
  4 from rest_framework.response import Response
  5 
  6 from examples.models import Comment
  7 from examples.permissions import IsOwnComment
  8 from examples.serializers import CommentSerializer
  9 from projects.permissions import IsProjectMember
  10 
  11 
  12 class CommentList(generics.ListCreateAPIView):
  13     permission_classes = [IsAuthenticated & IsProjectMember]
  14     serializer_class = CommentSerializer
  15     filter_backends = (DjangoFilterBackend, filters.SearchFilter)
  16     filterset_fields = ["example"]
  17     search_fields = ("text",)
  18 
  19     def get_queryset(self):
  20         queryset = Comment.objects.filter(example__project_id=self.kwargs["project_id"])
  21         return queryset
  22 
  23     def perform_create(self, serializer):
  24         serializer.save(example_id=self.request.query_params.get("example"), user=self.request.user)
  25 
  26     def delete(self, request, *args, **kwargs):
  27         delete_ids = request.data["ids"]
  28         Comment.objects.filter(user=request.user, pk__in=delete_ids).delete()
  29         return Response(status=status.HTTP_204_NO_CONTENT)
  30 
  31 
  32 class CommentDetail(generics.RetrieveUpdateDestroyAPIView):
  33     queryset = Comment.objects.all()
  34     serializer_class = CommentSerializer
  35     lookup_url_kwarg = "comment_id"
  36     permission_classes = [IsAuthenticated & IsProjectMember & IsOwnComment]
  37
  [end of backend/examples/views/comment.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/examples/views/comment.py b/backend/examples/views/comment.py
  --- a/backend/examples/views/comment.py
  +++ b/backend/examples/views/comment.py
  @@ -12,9 +12,10 @@
   class CommentList(generics.ListCreateAPIView):
       permission_classes = [IsAuthenticated & IsProjectMember]
       serializer_class = CommentSerializer
  -    filter_backends = (DjangoFilterBackend, filters.SearchFilter)
  +    filter_backends = (DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter)
       filterset_fields = ["example"]
       search_fields = ("text",)
  +    ordering_fields = ("created_at", "example")
   
       def get_queryset(self):
           queryset = Comment.objects.filter(example__project_id=self.kwargs["project_id"])
  
verification_info: {"golden_diff": "diff --git a/backend/examples/views/comment.py b/backend/examples/views/comment.py\n--- a/backend/examples/views/comment.py\n+++ b/backend/examples/views/comment.py\n@@ -12,9 +12,10 @@\n class CommentList(generics.ListCreateAPIView):\n     permission_classes = [IsAuthenticated & IsProjectMember]\n     serializer_class = CommentSerializer\n-    filter_backends = (DjangoFilterBackend, filters.SearchFilter)\n+    filter_backends = (DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter)\n     filterset_fields = [\"example\"]\n     search_fields = (\"text\",)\n+    ordering_fields = (\"created_at\", \"example\")\n \n     def get_queryset(self):\n         queryset = Comment.objects.filter(example__project_id=self.kwargs[\"project_id\"])\n", "issue": "Include Example number in the Project Comments view\nFeature description\r\n---------\r\nOn the backend API and in the dataset annotation interface, the Comments are associated with specific Examples. But in the Project Comments view, the Example association is unclear--all the comments are grouped together.\r\n\r\nCan the Project Comments view tab be improved to detail Examples, maybe even sort or group by Example?\r\n\r\nThanks!\n", "before_files": [{"content": "from django_filters.rest_framework import DjangoFilterBackend\nfrom rest_framework import filters, generics, status\nfrom rest_framework.permissions import IsAuthenticated\nfrom rest_framework.response import Response\n\nfrom examples.models import Comment\nfrom examples.permissions import IsOwnComment\nfrom examples.serializers import CommentSerializer\nfrom projects.permissions import IsProjectMember\n\n\nclass CommentList(generics.ListCreateAPIView):\n    permission_classes = [IsAuthenticated & IsProjectMember]\n    serializer_class = CommentSerializer\n    filter_backends = (DjangoFilterBackend, filters.SearchFilter)\n    filterset_fields = [\"example\"]\n    search_fields = (\"text\",)\n\n    def get_queryset(self):\n        queryset = Comment.objects.filter(example__project_id=self.kwargs[\"project_id\"])\n        return queryset\n\n    def perform_create(self, serializer):\n        serializer.save(example_id=self.request.query_params.get(\"example\"), user=self.request.user)\n\n    def delete(self, request, *args, **kwargs):\n        delete_ids = request.data[\"ids\"]\n        Comment.objects.filter(user=request.user, pk__in=delete_ids).delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n\n\nclass CommentDetail(generics.RetrieveUpdateDestroyAPIView):\n    queryset = Comment.objects.all()\n    serializer_class = CommentSerializer\n    lookup_url_kwarg = \"comment_id\"\n    permission_classes = [IsAuthenticated & IsProjectMember & IsOwnComment]\n", "path": "backend/examples/views/comment.py"}]}