From aa82be2f7ec728c72a16659a732ab8aba1a9e52b Mon Sep 17 00:00:00 2001 From: Frederik Wille Date: Mon, 15 Apr 2024 15:54:21 +0200 Subject: [PATCH] Add another overload to path function Allows to pass NinjaAPI's ``.urls`` to Django's ``path`` function. Adding ``URLPattern`` to ``IncludedURLConf`` didn't work. My guess is that this is caused by the `str | None` in ``IncludedURLConf`` which is not as strict as the return type of ``ninja_api.urls`` fixes sbdchd/django-types#173 --- django-stubs/urls/conf.pyi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django-stubs/urls/conf.pyi b/django-stubs/urls/conf.pyi index e9d0a9b42..ab3638f03 100644 --- a/django-stubs/urls/conf.pyi +++ b/django-stubs/urls/conf.pyi @@ -32,6 +32,13 @@ def path( kwargs: dict[str, Any] = ..., name: str = ..., ) -> URLResolver: ... +@overload +def path( + route: str, + view: tuple[list[URLResolver | URLPattern], str, str], + kwargs: dict[str, Any] = ..., + name: str = ..., +) -> URLResolver: ... # re_path() @overload