From 2a070e0a3306875b2d8e436ca4f96083ae36224b Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Wed, 9 Oct 2024 16:00:05 +0200 Subject: [PATCH] Drop `Context` from allowed types of template render method [DEP 182](https://github.com/django/deps/blob/main/final/0182-multiple-template-engines.rst#backends-api) states: "If `context` is provided, it must be a `dict`.". While the `Jinja2` and `TemplateStrings` backends support arbitrary mappings, `DjangoTemplates` calls `make_context()`, which only supports `dict` (and `None`). --- django-stubs/template/backends/base.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/django-stubs/template/backends/base.pyi b/django-stubs/template/backends/base.pyi index 476b1854e..f9b58e427 100644 --- a/django-stubs/template/backends/base.pyi +++ b/django-stubs/template/backends/base.pyi @@ -2,7 +2,6 @@ from collections.abc import Iterator, Mapping from typing import Any, Protocol, type_check_only from django.http.request import HttpRequest -from django.template.base import Context from django.utils.functional import cached_property from django.utils.safestring import SafeString @@ -23,6 +22,6 @@ class BaseEngine: class _EngineTemplate(Protocol): def render( self, - context: Context | dict[str, Any] | None = ..., + context: dict[str, Any] | None = ..., request: HttpRequest | None = ..., ) -> SafeString: ...