Skip to content

Commit

Permalink
Improve types for get_formset and get_template (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
last-partizan authored Dec 29, 2023
1 parent 2b5c58f commit 5896169
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion django-stubs/db/models/manager.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BaseManager(QuerySet[_T]):
@classmethod
def from_queryset(
cls, queryset_class: type[QuerySet[_T]], class_name: str | None = ...
) -> type[Manager[_T]]: ...
) -> type[Self]: ...
@classmethod
def _get_queryset_methods(
cls, queryset_class: type[QuerySet[_T]]
Expand Down
9 changes: 9 additions & 0 deletions django-stubs/template/backends/django.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Iterator
from typing import Any

from django.template import base
from django.template.engine import Engine
from django.template.exceptions import TemplateDoesNotExist

Expand All @@ -13,6 +14,14 @@ class DjangoTemplates(BaseEngine):
self, custom_libraries: dict[str, str]
) -> dict[str, str]: ...

class Template:
template: base.Template
backend: BaseEngine
def __init__(self, template: base.Template, backend: BaseEngine) -> None: ...
@property
def origin(self) -> base.Origin: ...
def render(self, context: Any = ..., request: Any = ...) -> str: ...

def copy_exception(
exc: TemplateDoesNotExist, backend: DjangoTemplates | None = ...
) -> TemplateDoesNotExist: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/template/loader.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any

from django.http.request import HttpRequest
from django.template.base import Template
from django.template.backends.django import Template
from django.template.exceptions import ( # noqa: F401
TemplateDoesNotExist as TemplateDoesNotExist,
)
Expand Down

0 comments on commit 5896169

Please sign in to comment.