prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Unsupported upload interface type breaks later file uploads widgets
  I have a reader study with a 3d-liver-model interface (.obj kind). The following likely also extends to archive items.
  
  We don't support uploading these via the UI.
  
  However, when one of these interfaces is present all subsequent file upload widgets are not loaded on page: https://grand-challenge.org/reader-studies/chris-test-reader-study-the-second-coming/display-sets/create-single/
  
  ![image](https://github.com/comic/grand-challenge.org/assets/7871310/7b167978-def3-46b3-b301-ecb9cda7b24e)
  
  I've since removed the display set with the interface to quickly do a workaround.
  
  Not sure if this needs to be fixed or is so corner case that we can safely ignore it.
  
  </issue>
  <code>
  [start of app/grandchallenge/uploads/widgets.py]
  1 from django.forms.widgets import HiddenInput, MultipleHiddenInput
  2 
  3 
  4 class UserUploadWidgetMixin:
  5     template_name = "uploads/widget.html"
  6     input_type = None
  7 
  8     def __init__(self, *args, allowed_file_types=None, **kwargs):
  9         super().__init__(*args, **kwargs)
  10         self.allowed_file_types = allowed_file_types
  11 
  12     def get_context(self, *args, **kwargs):
  13         context = super().get_context(*args, **kwargs)
  14         context["widget"]["allowed_file_types"] = {
  15             "id": f"{context['widget']['attrs']['id']}AllowedFileTypes",
  16             "value": self.allowed_file_types,
  17         }
  18         return context
  19 
  20     class Media:
  21         css = {"all": ("vendored/uppy/uppy.min.css",)}
  22         js = (
  23             "vendored/uppy/uppy.min.js",
  24             "js/user_upload.js",
  25         )
  26 
  27 
  28 class UserUploadSingleWidget(UserUploadWidgetMixin, HiddenInput):
  29     pass
  30 
  31 
  32 class UserUploadMultipleWidget(UserUploadWidgetMixin, MultipleHiddenInput):
  33     def get_context(self, name, value, attrs):
  34         context = super().get_context(name, value, attrs)
  35         context["widget"]["attrs"]["multiple"] = True
  36         return context
  37
  [end of app/grandchallenge/uploads/widgets.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/app/grandchallenge/uploads/widgets.py b/app/grandchallenge/uploads/widgets.py
  --- a/app/grandchallenge/uploads/widgets.py
  +++ b/app/grandchallenge/uploads/widgets.py
  @@ -11,8 +11,10 @@
   
       def get_context(self, *args, **kwargs):
           context = super().get_context(*args, **kwargs)
  +        widget_id = f'X_{context["widget"]["attrs"]["id"]}'
  +        context["widget"]["attrs"]["id"] = widget_id
           context["widget"]["allowed_file_types"] = {
  -            "id": f"{context['widget']['attrs']['id']}AllowedFileTypes",
  +            "id": f"{widget_id}AllowedFileTypes",
               "value": self.allowed_file_types,
           }
           return context
  
verification_info: {"golden_diff": "diff --git a/app/grandchallenge/uploads/widgets.py b/app/grandchallenge/uploads/widgets.py\n--- a/app/grandchallenge/uploads/widgets.py\n+++ b/app/grandchallenge/uploads/widgets.py\n@@ -11,8 +11,10 @@\n \n     def get_context(self, *args, **kwargs):\n         context = super().get_context(*args, **kwargs)\n+        widget_id = f'X_{context[\"widget\"][\"attrs\"][\"id\"]}'\n+        context[\"widget\"][\"attrs\"][\"id\"] = widget_id\n         context[\"widget\"][\"allowed_file_types\"] = {\n-            \"id\": f\"{context['widget']['attrs']['id']}AllowedFileTypes\",\n+            \"id\": f\"{widget_id}AllowedFileTypes\",\n             \"value\": self.allowed_file_types,\n         }\n         return context\n", "issue": "Unsupported upload interface type breaks later file uploads widgets\nI have a reader study with a 3d-liver-model interface (.obj kind). The following likely also extends to archive items.\r\n\r\nWe don't support uploading these via the UI.\r\n\r\nHowever, when one of these interfaces is present all subsequent file upload widgets are not loaded on page: https://grand-challenge.org/reader-studies/chris-test-reader-study-the-second-coming/display-sets/create-single/\r\n\r\n![image](https://github.com/comic/grand-challenge.org/assets/7871310/7b167978-def3-46b3-b301-ecb9cda7b24e)\r\n\r\nI've since removed the display set with the interface to quickly do a workaround.\r\n\r\nNot sure if this needs to be fixed or is so corner case that we can safely ignore it.\n", "before_files": [{"content": "from django.forms.widgets import HiddenInput, MultipleHiddenInput\n\n\nclass UserUploadWidgetMixin:\n    template_name = \"uploads/widget.html\"\n    input_type = None\n\n    def __init__(self, *args, allowed_file_types=None, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.allowed_file_types = allowed_file_types\n\n    def get_context(self, *args, **kwargs):\n        context = super().get_context(*args, **kwargs)\n        context[\"widget\"][\"allowed_file_types\"] = {\n            \"id\": f\"{context['widget']['attrs']['id']}AllowedFileTypes\",\n            \"value\": self.allowed_file_types,\n        }\n        return context\n\n    class Media:\n        css = {\"all\": (\"vendored/uppy/uppy.min.css\",)}\n        js = (\n            \"vendored/uppy/uppy.min.js\",\n            \"js/user_upload.js\",\n        )\n\n\nclass UserUploadSingleWidget(UserUploadWidgetMixin, HiddenInput):\n    pass\n\n\nclass UserUploadMultipleWidget(UserUploadWidgetMixin, MultipleHiddenInput):\n    def get_context(self, name, value, attrs):\n        context = super().get_context(name, value, attrs)\n        context[\"widget\"][\"attrs\"][\"multiple\"] = True\n        return context\n", "path": "app/grandchallenge/uploads/widgets.py"}]}