Skip to content

Commit

Permalink
Drop Context from allowed types of template render method
Browse files Browse the repository at this point in the history
[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`).
  • Loading branch information
mthuurne committed Oct 9, 2024
1 parent 0f43c96 commit 2a070e0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions django-stubs/template/backends/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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: ...

0 comments on commit 2a070e0

Please sign in to comment.