From 8de9d9a7b1ac40399ae7b05f1512fb5c72960ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 25 Oct 2024 09:12:38 +0200 Subject: [PATCH] Allow `None` on `view_on_site` (#2419) This makes it consistent with `get_view_on_site_url` signature where it is used. --- django-stubs/contrib/admin/options.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi index 892b91cb3..3a5ca8ab8 100644 --- a/django-stubs/contrib/admin/options.pyi +++ b/django-stubs/contrib/admin/options.pyi @@ -139,7 +139,7 @@ class BaseModelAdmin(Generic[_ModelT]): def has_view_or_change_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ... def has_module_permission(self, request: HttpRequest) -> bool: ... @property - def view_on_site(self) -> Callable[[_ModelT], str] | bool: ... + def view_on_site(self) -> Callable[[_ModelT], str | None] | bool: ... _ModelAdmin = TypeVar("_ModelAdmin", bound=ModelAdmin[Any]) _ActionCallable: TypeAlias = Callable[[_ModelAdmin, HttpRequest, QuerySet[_ModelT]], HttpResponseBase | None]