From 5a075be90802806b3225bf84d89d0c68fb346c4a Mon Sep 17 00:00:00 2001 From: Maxim Kurnikov Date: Fri, 21 Dec 2018 05:10:39 +0300 Subject: [PATCH] add django.shortcuts --- django-stubs/shortcuts.pyi | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 django-stubs/shortcuts.pyi diff --git a/django-stubs/shortcuts.pyi b/django-stubs/shortcuts.pyi new file mode 100644 index 0000000..d5958ef --- /dev/null +++ b/django-stubs/shortcuts.pyi @@ -0,0 +1,26 @@ +from typing import Any, Callable, Dict, List, Optional, Type, Union + +from django.db.models.base import Model +from django.http.response import HttpResponse, HttpResponseRedirect + +from django.http import HttpRequest + +def render_to_response( + template_name: Union[List[str], str], + context: Optional[Dict[str, str]] = ..., + content_type: Optional[str] = ..., + status: Optional[int] = ..., + using: Optional[str] = ..., +) -> HttpResponse: ... +def render( + request: HttpRequest, + template_name: Union[List[str], str], + context: Optional[Dict[str, bool]] = ..., + content_type: Optional[str] = ..., + status: Optional[int] = ..., + using: Optional[str] = ..., +) -> HttpResponse: ... +def redirect(to: Union[Callable, str], *args: Any, permanent: bool = ..., **kwargs: Any) -> HttpResponseRedirect: ... +def get_object_or_404(klass: Union[Type[Model], str], *args: Any, **kwargs: Any) -> Model: ... +def get_list_or_404(klass: List[Type[Model]], *args: Any, **kwargs: Any) -> List[Model]: ... +def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ...