Skip to content

Commit

Permalink
Make from_string() and get_template() return backend-specific tem…
Browse files Browse the repository at this point in the history
…plate
  • Loading branch information
mthuurne committed Oct 9, 2024
1 parent 4c7548d commit 7cfc407
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions django-stubs/template/backends/django.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ from .base import BaseEngine, _EngineTemplate
class DjangoTemplates(BaseEngine):
engine: Engine
def __init__(self, params: dict[str, Any]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
def get_templatetag_libraries(self, custom_libraries: dict[str, str]) -> dict[str, str]: ...

def copy_exception(exc: TemplateDoesNotExist, backend: DjangoTemplates | None = None) -> TemplateDoesNotExist: ...
Expand Down
2 changes: 2 additions & 0 deletions django-stubs/template/backends/dummy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ from .base import BaseEngine

class TemplateStrings(BaseEngine):
def __init__(self, params: dict[str, dict[Any, Any] | list[Any] | bool | str]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...

class Template(string.Template):
template: str
Expand Down
2 changes: 2 additions & 0 deletions django-stubs/template/backends/jinja2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Jinja2(BaseEngine):
env: Any
context_processors: list[str]
def __init__(self, params: dict[str, Any]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
@cached_property
def template_context_processors(self) -> list[Callable]: ...

Expand Down

0 comments on commit 7cfc407

Please sign in to comment.