prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Niekompletny wykaz endpointów API w /api
  Na `/api` (np. https://dev.small-eod.siecobywatelska.pl/api/ ) nie mamy kompletnego wykazu endpointów API. Kompletny jest dostępny przez ReDoc np. na https://dev.small-eod.siecobywatelska.pl/api/redoc/ .
  
  Powinniśmy to naprawić, bo wprowadza ryzyko mylnego wrażenia co do zakresu API.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `backend-project/config/urls.py`
  Content:
  ```
  1 """small_eod URL Configuration
  2 
  3 The `urlpatterns` list routes URLs to views. For more information please see:
  4     https://docs.djangoproject.com/en/3.0/topics/http/urls/
  5 Examples:
  6 Function views
  7     1. Add an import:  from my_app import views
  8     2. Add a URL to urlpatterns:  path('', views.home, name='home')
  9 Class-based views
  10     1. Add an import:  from other_app.views import Home
  11     2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
  12 Including another URLconf
  13     1. Import the include() function: from django.urls import include, path
  14     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
  15 """
  16 from django.conf import settings
  17 from django.conf.urls.static import static
  18 from django.contrib import admin
  19 from django.urls import include, path, re_path
  20 from drf_yasg2.views import get_schema_view
  21 from rest_framework import permissions, routers
  22 
  23 from small_eod.channels.views import ChannelViewSet
  24 from small_eod.events.views import EventViewSet
  25 from small_eod.institutions.views import InstitutionViewSet
  26 from small_eod.notes.views import NoteViewSet
  27 from small_eod.tags.views import TagViewSet
  28 from small_eod.users.views import UserViewSet
  29 
  30 from .swagger import info
  31 
  32 router = routers.DefaultRouter()
  33 router.register(r"channels", ChannelViewSet)
  34 router.register(r"events", EventViewSet)
  35 router.register(r"institutions", InstitutionViewSet)
  36 router.register(r"notes", NoteViewSet)
  37 router.register(r"tags", TagViewSet)
  38 router.register(r"users", UserViewSet)
  39 
  40 schema_view = get_schema_view(
  41     info,
  42     # validators=['flex', 'ssv'],
  43     public=True,
  44     permission_classes=(permissions.AllowAny,),
  45 )
  46 
  47 urlpatterns = [
  48     path("admin/", admin.site.urls),
  49     path("api/", include("small_eod.collections.urls")),
  50     path("api/", include("small_eod.cases.urls")),
  51     path("api/", include("small_eod.letters.urls")),
  52     path("api/", include("small_eod.features.urls")),
  53     path("api/", include("small_eod.administrative_units.urls")),
  54     path("api/", include("small_eod.autocomplete.urls")),
  55     path("api/docs/", schema_view.with_ui("swagger"), name="api_docs"),
  56     path("api/redoc/", schema_view.with_ui("redoc"), name="api_redocs"),
  57     re_path(
  58         "^api/swagger(?P<format>.json|.yaml)$",
  59         schema_view.without_ui(),
  60         name="schema_swagger",
  61     ),
  62     path("api/", include(router.urls)),
  63 ]
  64 
  65 
  66 if settings.DEBUG:
  67     import debug_toolbar
  68 
  69     urlpatterns += [
  70         path("__debug__/", include(debug_toolbar.urls)),
  71     ]
  72 
  73     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  74     urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_URL)
  75
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/backend-project/config/urls.py b/backend-project/config/urls.py
  --- a/backend-project/config/urls.py
  +++ b/backend-project/config/urls.py
  @@ -13,6 +13,9 @@
       1. Import the include() function: from django.urls import include, path
       2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
   """
  +
  +import re
  +
   from django.conf import settings
   from django.conf.urls.static import static
   from django.contrib import admin
  @@ -29,13 +32,56 @@
   
   from .swagger import info
   
  -router = routers.DefaultRouter()
  +
  +class BetterDefaultRouter(routers.DefaultRouter):
  +    def __init__(self, *args, **kwargs):
  +        super().__init__(*args, **kwargs)
  +        self.include_urls = []
  +        self.api_root_dict = {}
  +
  +    def get_urls(self):
  +        urls = super().get_urls()
  +        urls.extend(self.include_urls)
  +        return urls
  +
  +    def include(self, module):
  +        urlpatterns = getattr(include(module)[0], "urlpatterns")
  +        viewnames = set()
  +        for urlpattern in urlpatterns:
  +            self.include_urls.append(urlpattern)
  +            if hasattr(urlpattern, "url_patterns"):
  +                viewnames.update([pattern.name for pattern in urlpattern.url_patterns])
  +            elif hasattr(urlpattern, "name"):
  +                viewnames.add(urlpattern.name)
  +        self.api_root_dict.update(
  +            {re.sub(r"-list$", "", viewname): viewname for viewname in viewnames}
  +        )
  +
  +    def get_api_root_view(self, api_urls=None):
  +        api_root_dict = {}
  +        list_name = self.routes[0].name
  +
  +        for prefix, viewset, basename in self.registry:
  +            api_root_dict[prefix] = list_name.format(basename=basename)
  +        api_root_dict.update(self.api_root_dict)
  +
  +        return self.APIRootView.as_view(api_root_dict=api_root_dict)
  +
  +
  +router = BetterDefaultRouter()
  +
   router.register(r"channels", ChannelViewSet)
   router.register(r"events", EventViewSet)
   router.register(r"institutions", InstitutionViewSet)
   router.register(r"notes", NoteViewSet)
   router.register(r"tags", TagViewSet)
   router.register(r"users", UserViewSet)
  +router.include("small_eod.cases.urls")
  +router.include("small_eod.features.urls")
  +router.include("small_eod.collections.urls")
  +router.include("small_eod.letters.urls")
  +router.include("small_eod.administrative_units.urls")
  +router.include("small_eod.autocomplete.urls")
   
   schema_view = get_schema_view(
       info,
  @@ -46,12 +92,6 @@
   
   urlpatterns = [
       path("admin/", admin.site.urls),
  -    path("api/", include("small_eod.collections.urls")),
  -    path("api/", include("small_eod.cases.urls")),
  -    path("api/", include("small_eod.letters.urls")),
  -    path("api/", include("small_eod.features.urls")),
  -    path("api/", include("small_eod.administrative_units.urls")),
  -    path("api/", include("small_eod.autocomplete.urls")),
       path("api/docs/", schema_view.with_ui("swagger"), name="api_docs"),
       path("api/redoc/", schema_view.with_ui("redoc"), name="api_redocs"),
       re_path(
  @@ -62,7 +102,6 @@
       path("api/", include(router.urls)),
   ]
   
  -
   if settings.DEBUG:
       import debug_toolbar
  
verification_info: {"golden_diff": "diff --git a/backend-project/config/urls.py b/backend-project/config/urls.py\n--- a/backend-project/config/urls.py\n+++ b/backend-project/config/urls.py\n@@ -13,6 +13,9 @@\n     1. Import the include() function: from django.urls import include, path\n     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))\n \"\"\"\n+\n+import re\n+\n from django.conf import settings\n from django.conf.urls.static import static\n from django.contrib import admin\n@@ -29,13 +32,56 @@\n \n from .swagger import info\n \n-router = routers.DefaultRouter()\n+\n+class BetterDefaultRouter(routers.DefaultRouter):\n+    def __init__(self, *args, **kwargs):\n+        super().__init__(*args, **kwargs)\n+        self.include_urls = []\n+        self.api_root_dict = {}\n+\n+    def get_urls(self):\n+        urls = super().get_urls()\n+        urls.extend(self.include_urls)\n+        return urls\n+\n+    def include(self, module):\n+        urlpatterns = getattr(include(module)[0], \"urlpatterns\")\n+        viewnames = set()\n+        for urlpattern in urlpatterns:\n+            self.include_urls.append(urlpattern)\n+            if hasattr(urlpattern, \"url_patterns\"):\n+                viewnames.update([pattern.name for pattern in urlpattern.url_patterns])\n+            elif hasattr(urlpattern, \"name\"):\n+                viewnames.add(urlpattern.name)\n+        self.api_root_dict.update(\n+            {re.sub(r\"-list$\", \"\", viewname): viewname for viewname in viewnames}\n+        )\n+\n+    def get_api_root_view(self, api_urls=None):\n+        api_root_dict = {}\n+        list_name = self.routes[0].name\n+\n+        for prefix, viewset, basename in self.registry:\n+            api_root_dict[prefix] = list_name.format(basename=basename)\n+        api_root_dict.update(self.api_root_dict)\n+\n+        return self.APIRootView.as_view(api_root_dict=api_root_dict)\n+\n+\n+router = BetterDefaultRouter()\n+\n router.register(r\"channels\", ChannelViewSet)\n router.register(r\"events\", EventViewSet)\n router.register(r\"institutions\", InstitutionViewSet)\n router.register(r\"notes\", NoteViewSet)\n router.register(r\"tags\", TagViewSet)\n router.register(r\"users\", UserViewSet)\n+router.include(\"small_eod.cases.urls\")\n+router.include(\"small_eod.features.urls\")\n+router.include(\"small_eod.collections.urls\")\n+router.include(\"small_eod.letters.urls\")\n+router.include(\"small_eod.administrative_units.urls\")\n+router.include(\"small_eod.autocomplete.urls\")\n \n schema_view = get_schema_view(\n     info,\n@@ -46,12 +92,6 @@\n \n urlpatterns = [\n     path(\"admin/\", admin.site.urls),\n-    path(\"api/\", include(\"small_eod.collections.urls\")),\n-    path(\"api/\", include(\"small_eod.cases.urls\")),\n-    path(\"api/\", include(\"small_eod.letters.urls\")),\n-    path(\"api/\", include(\"small_eod.features.urls\")),\n-    path(\"api/\", include(\"small_eod.administrative_units.urls\")),\n-    path(\"api/\", include(\"small_eod.autocomplete.urls\")),\n     path(\"api/docs/\", schema_view.with_ui(\"swagger\"), name=\"api_docs\"),\n     path(\"api/redoc/\", schema_view.with_ui(\"redoc\"), name=\"api_redocs\"),\n     re_path(\n@@ -62,7 +102,6 @@\n     path(\"api/\", include(router.urls)),\n ]\n \n-\n if settings.DEBUG:\n     import debug_toolbar\n", "issue": "Niekompletny wykaz endpoint\u00f3w API w /api\nNa `/api` (np. https://dev.small-eod.siecobywatelska.pl/api/ ) nie mamy kompletnego wykazu endpoint\u00f3w API. Kompletny jest dost\u0119pny przez ReDoc np. na https://dev.small-eod.siecobywatelska.pl/api/redoc/ .\r\n\r\nPowinni\u015bmy to naprawi\u0107, bo wprowadza ryzyko mylnego wra\u017cenia co do zakresu API.\n", "before_files": [{"content": "\"\"\"small_eod URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n    https://docs.djangoproject.com/en/3.0/topics/http/urls/\nExamples:\nFunction views\n    1. Add an import:  from my_app import views\n    2. Add a URL to urlpatterns:  path('', views.home, name='home')\nClass-based views\n    1. Add an import:  from other_app.views import Home\n    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')\nIncluding another URLconf\n    1. Import the include() function: from django.urls import include, path\n    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))\n\"\"\"\nfrom django.conf import settings\nfrom django.conf.urls.static import static\nfrom django.contrib import admin\nfrom django.urls import include, path, re_path\nfrom drf_yasg2.views import get_schema_view\nfrom rest_framework import permissions, routers\n\nfrom small_eod.channels.views import ChannelViewSet\nfrom small_eod.events.views import EventViewSet\nfrom small_eod.institutions.views import InstitutionViewSet\nfrom small_eod.notes.views import NoteViewSet\nfrom small_eod.tags.views import TagViewSet\nfrom small_eod.users.views import UserViewSet\n\nfrom .swagger import info\n\nrouter = routers.DefaultRouter()\nrouter.register(r\"channels\", ChannelViewSet)\nrouter.register(r\"events\", EventViewSet)\nrouter.register(r\"institutions\", InstitutionViewSet)\nrouter.register(r\"notes\", NoteViewSet)\nrouter.register(r\"tags\", TagViewSet)\nrouter.register(r\"users\", UserViewSet)\n\nschema_view = get_schema_view(\n    info,\n    # validators=['flex', 'ssv'],\n    public=True,\n    permission_classes=(permissions.AllowAny,),\n)\n\nurlpatterns = [\n    path(\"admin/\", admin.site.urls),\n    path(\"api/\", include(\"small_eod.collections.urls\")),\n    path(\"api/\", include(\"small_eod.cases.urls\")),\n    path(\"api/\", include(\"small_eod.letters.urls\")),\n    path(\"api/\", include(\"small_eod.features.urls\")),\n    path(\"api/\", include(\"small_eod.administrative_units.urls\")),\n    path(\"api/\", include(\"small_eod.autocomplete.urls\")),\n    path(\"api/docs/\", schema_view.with_ui(\"swagger\"), name=\"api_docs\"),\n    path(\"api/redoc/\", schema_view.with_ui(\"redoc\"), name=\"api_redocs\"),\n    re_path(\n        \"^api/swagger(?P<format>.json|.yaml)$\",\n        schema_view.without_ui(),\n        name=\"schema_swagger\",\n    ),\n    path(\"api/\", include(router.urls)),\n]\n\n\nif settings.DEBUG:\n    import debug_toolbar\n\n    urlpatterns += [\n        path(\"__debug__/\", include(debug_toolbar.urls)),\n    ]\n\n    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_URL)\n", "path": "backend-project/config/urls.py"}], "after_files": [{"content": "\"\"\"small_eod URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n    https://docs.djangoproject.com/en/3.0/topics/http/urls/\nExamples:\nFunction views\n    1. Add an import:  from my_app import views\n    2. Add a URL to urlpatterns:  path('', views.home, name='home')\nClass-based views\n    1. Add an import:  from other_app.views import Home\n    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')\nIncluding another URLconf\n    1. Import the include() function: from django.urls import include, path\n    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))\n\"\"\"\n\nimport re\n\nfrom django.conf import settings\nfrom django.conf.urls.static import static\nfrom django.contrib import admin\nfrom django.urls import include, path, re_path\nfrom drf_yasg2.views import get_schema_view\nfrom rest_framework import permissions, routers\n\nfrom small_eod.channels.views import ChannelViewSet\nfrom small_eod.events.views import EventViewSet\nfrom small_eod.institutions.views import InstitutionViewSet\nfrom small_eod.notes.views import NoteViewSet\nfrom small_eod.tags.views import TagViewSet\nfrom small_eod.users.views import UserViewSet\n\nfrom .swagger import info\n\n\nclass BetterDefaultRouter(routers.DefaultRouter):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.include_urls = []\n        self.api_root_dict = {}\n\n    def get_urls(self):\n        urls = super().get_urls()\n        urls.extend(self.include_urls)\n        return urls\n\n    def include(self, module):\n        urlpatterns = getattr(include(module)[0], \"urlpatterns\")\n        viewnames = set()\n        for urlpattern in urlpatterns:\n            self.include_urls.append(urlpattern)\n            if hasattr(urlpattern, \"url_patterns\"):\n                viewnames.update([pattern.name for pattern in urlpattern.url_patterns])\n            elif hasattr(urlpattern, \"name\"):\n                viewnames.add(urlpattern.name)\n        self.api_root_dict.update(\n            {re.sub(r\"-list$\", \"\", viewname): viewname for viewname in viewnames}\n        )\n\n    def get_api_root_view(self, api_urls=None):\n        api_root_dict = {}\n        list_name = self.routes[0].name\n\n        for prefix, viewset, basename in self.registry:\n            api_root_dict[prefix] = list_name.format(basename=basename)\n        api_root_dict.update(self.api_root_dict)\n\n        return self.APIRootView.as_view(api_root_dict=api_root_dict)\n\n\nrouter = BetterDefaultRouter()\n\nrouter.register(r\"channels\", ChannelViewSet)\nrouter.register(r\"events\", EventViewSet)\nrouter.register(r\"institutions\", InstitutionViewSet)\nrouter.register(r\"notes\", NoteViewSet)\nrouter.register(r\"tags\", TagViewSet)\nrouter.register(r\"users\", UserViewSet)\nrouter.include(\"small_eod.cases.urls\")\nrouter.include(\"small_eod.features.urls\")\nrouter.include(\"small_eod.collections.urls\")\nrouter.include(\"small_eod.letters.urls\")\nrouter.include(\"small_eod.administrative_units.urls\")\nrouter.include(\"small_eod.autocomplete.urls\")\n\nschema_view = get_schema_view(\n    info,\n    # validators=['flex', 'ssv'],\n    public=True,\n    permission_classes=(permissions.AllowAny,),\n)\n\nurlpatterns = [\n    path(\"admin/\", admin.site.urls),\n    path(\"api/docs/\", schema_view.with_ui(\"swagger\"), name=\"api_docs\"),\n    path(\"api/redoc/\", schema_view.with_ui(\"redoc\"), name=\"api_redocs\"),\n    re_path(\n        \"^api/swagger(?P<format>.json|.yaml)$\",\n        schema_view.without_ui(),\n        name=\"schema_swagger\",\n    ),\n    path(\"api/\", include(router.urls)),\n]\n\nif settings.DEBUG:\n    import debug_toolbar\n\n    urlpatterns += [\n        path(\"__debug__/\", include(debug_toolbar.urls)),\n    ]\n\n    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_URL)\n", "path": "backend-project/config/urls.py"}]}