prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Allow querying `ChainInfo` by `shortName`
  @rmeissner add use case
  
  </issue>
  <code>
  [start of src/chains/urls.py]
  1 from django.urls import path
  2 
  3 from chains.views import ChainsDetailView, ChainsListView
  4 
  5 app_name = "chains"
  6 
  7 urlpatterns = [
  8     path("", ChainsListView.as_view(), name="list"),
  9     path("<pk>/", ChainsDetailView.as_view(), name="detail"),
  10 ]
  11
  [end of src/chains/urls.py]
  [start of src/chains/views.py]
  1 from rest_framework import filters
  2 from rest_framework.generics import ListAPIView, RetrieveAPIView
  3 from rest_framework.pagination import LimitOffsetPagination
  4 
  5 from .models import Chain
  6 from .serializers import ChainSerializer
  7 
  8 
  9 class ChainsListView(ListAPIView):
  10     serializer_class = ChainSerializer
  11     pagination_class = LimitOffsetPagination
  12     pagination_class.max_limit = 100
  13     pagination_class.default_limit = 10
  14     queryset = Chain.objects.all()
  15     filter_backends = [filters.OrderingFilter]
  16     ordering_fields = ["relevance", "name"]
  17     ordering = [
  18         "relevance",
  19         "name",
  20     ]
  21 
  22 
  23 class ChainsDetailView(RetrieveAPIView):
  24     serializer_class = ChainSerializer
  25     queryset = Chain.objects.all()
  26
  [end of src/chains/views.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/src/chains/urls.py b/src/chains/urls.py
  --- a/src/chains/urls.py
  +++ b/src/chains/urls.py
  @@ -1,10 +1,15 @@
   from django.urls import path
   
  -from chains.views import ChainsDetailView, ChainsListView
  +from chains.views import ChainsDetailView, ChainsDetailViewByShortName, ChainsListView
   
   app_name = "chains"
   
   urlpatterns = [
       path("", ChainsListView.as_view(), name="list"),
  -    path("<pk>/", ChainsDetailView.as_view(), name="detail"),
  +    path("<int:pk>/", ChainsDetailView.as_view(), name="detail"),
  +    path(
  +        "<str:short_name>/",
  +        ChainsDetailViewByShortName.as_view(),
  +        name="detail_by_short_name",
  +    ),
   ]
  diff --git a/src/chains/views.py b/src/chains/views.py
  --- a/src/chains/views.py
  +++ b/src/chains/views.py
  @@ -1,6 +1,11 @@
  +from typing import Any
  +
  +from drf_yasg.utils import swagger_auto_schema
   from rest_framework import filters
   from rest_framework.generics import ListAPIView, RetrieveAPIView
   from rest_framework.pagination import LimitOffsetPagination
  +from rest_framework.request import Request
  +from rest_framework.response import Response
   
   from .models import Chain
   from .serializers import ChainSerializer
  @@ -23,3 +28,22 @@
   class ChainsDetailView(RetrieveAPIView):
       serializer_class = ChainSerializer
       queryset = Chain.objects.all()
  +
  +    @swagger_auto_schema(
  +        operation_id="Get chain by id"
  +    )  # type: ignore[misc] # Untyped decorator makes function "get" untyped
  +    def get(self, request: Request, *args: Any, **kwargs: Any) -> Response:
  +        return super().get(request, *args, **kwargs)
  +
  +
  +class ChainsDetailViewByShortName(RetrieveAPIView):
  +    lookup_field = "short_name"
  +    serializer_class = ChainSerializer
  +    queryset = Chain.objects.all()
  +
  +    @swagger_auto_schema(
  +        operation_id="Get chain by shortName",
  +        operation_description="Warning: `shortNames` may contain characters that need to be URL encoded (i.e.: whitespaces)",  # noqa E501
  +    )  # type: ignore[misc] # Untyped decorator makes function "get" untyped
  +    def get(self, request: Request, *args: Any, **kwargs: Any) -> Response:
  +        return super().get(request, *args, **kwargs)
  
verification_info: {"golden_diff": "diff --git a/src/chains/urls.py b/src/chains/urls.py\n--- a/src/chains/urls.py\n+++ b/src/chains/urls.py\n@@ -1,10 +1,15 @@\n from django.urls import path\n \n-from chains.views import ChainsDetailView, ChainsListView\n+from chains.views import ChainsDetailView, ChainsDetailViewByShortName, ChainsListView\n \n app_name = \"chains\"\n \n urlpatterns = [\n     path(\"\", ChainsListView.as_view(), name=\"list\"),\n-    path(\"<pk>/\", ChainsDetailView.as_view(), name=\"detail\"),\n+    path(\"<int:pk>/\", ChainsDetailView.as_view(), name=\"detail\"),\n+    path(\n+        \"<str:short_name>/\",\n+        ChainsDetailViewByShortName.as_view(),\n+        name=\"detail_by_short_name\",\n+    ),\n ]\ndiff --git a/src/chains/views.py b/src/chains/views.py\n--- a/src/chains/views.py\n+++ b/src/chains/views.py\n@@ -1,6 +1,11 @@\n+from typing import Any\n+\n+from drf_yasg.utils import swagger_auto_schema\n from rest_framework import filters\n from rest_framework.generics import ListAPIView, RetrieveAPIView\n from rest_framework.pagination import LimitOffsetPagination\n+from rest_framework.request import Request\n+from rest_framework.response import Response\n \n from .models import Chain\n from .serializers import ChainSerializer\n@@ -23,3 +28,22 @@\n class ChainsDetailView(RetrieveAPIView):\n     serializer_class = ChainSerializer\n     queryset = Chain.objects.all()\n+\n+    @swagger_auto_schema(\n+        operation_id=\"Get chain by id\"\n+    )  # type: ignore[misc] # Untyped decorator makes function \"get\" untyped\n+    def get(self, request: Request, *args: Any, **kwargs: Any) -> Response:\n+        return super().get(request, *args, **kwargs)\n+\n+\n+class ChainsDetailViewByShortName(RetrieveAPIView):\n+    lookup_field = \"short_name\"\n+    serializer_class = ChainSerializer\n+    queryset = Chain.objects.all()\n+\n+    @swagger_auto_schema(\n+        operation_id=\"Get chain by shortName\",\n+        operation_description=\"Warning: `shortNames` may contain characters that need to be URL encoded (i.e.: whitespaces)\",  # noqa E501\n+    )  # type: ignore[misc] # Untyped decorator makes function \"get\" untyped\n+    def get(self, request: Request, *args: Any, **kwargs: Any) -> Response:\n+        return super().get(request, *args, **kwargs)\n", "issue": "Allow querying `ChainInfo` by `shortName`\n@rmeissner add use case\n", "before_files": [{"content": "from django.urls import path\n\nfrom chains.views import ChainsDetailView, ChainsListView\n\napp_name = \"chains\"\n\nurlpatterns = [\n    path(\"\", ChainsListView.as_view(), name=\"list\"),\n    path(\"<pk>/\", ChainsDetailView.as_view(), name=\"detail\"),\n]\n", "path": "src/chains/urls.py"}, {"content": "from rest_framework import filters\nfrom rest_framework.generics import ListAPIView, RetrieveAPIView\nfrom rest_framework.pagination import LimitOffsetPagination\n\nfrom .models import Chain\nfrom .serializers import ChainSerializer\n\n\nclass ChainsListView(ListAPIView):\n    serializer_class = ChainSerializer\n    pagination_class = LimitOffsetPagination\n    pagination_class.max_limit = 100\n    pagination_class.default_limit = 10\n    queryset = Chain.objects.all()\n    filter_backends = [filters.OrderingFilter]\n    ordering_fields = [\"relevance\", \"name\"]\n    ordering = [\n        \"relevance\",\n        \"name\",\n    ]\n\n\nclass ChainsDetailView(RetrieveAPIView):\n    serializer_class = ChainSerializer\n    queryset = Chain.objects.all()\n", "path": "src/chains/views.py"}]}