mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 04:54:48 +08:00
rework django.views
This commit is contained in:
@@ -1,3 +1 @@
|
|||||||
from django.views.generic.base import View
|
from .generic.base import View as View
|
||||||
|
|
||||||
__all__ = ["View"]
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
from typing import Any, Optional
|
|
||||||
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseForbidden
|
from django.http.response import HttpResponseForbidden
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter):
|
|||||||
class ExceptionReporter:
|
class ExceptionReporter:
|
||||||
request: Optional[HttpRequest] = ...
|
request: Optional[HttpRequest] = ...
|
||||||
filter: ExceptionReporterFilter = ...
|
filter: ExceptionReporterFilter = ...
|
||||||
exc_type: None = ...
|
exc_type: Optional[Type[BaseException]] = ...
|
||||||
exc_value: Optional[str] = ...
|
exc_value: Optional[str] = ...
|
||||||
tb: None = ...
|
tb: Optional[TracebackType] = ...
|
||||||
is_email: bool = ...
|
is_email: bool = ...
|
||||||
template_info: None = ...
|
template_info: None = ...
|
||||||
template_does_not_exist: bool = ...
|
template_does_not_exist: bool = ...
|
||||||
@@ -59,7 +59,7 @@ class ExceptionReporter:
|
|||||||
lineno: int,
|
lineno: int,
|
||||||
context_lines: int,
|
context_lines: int,
|
||||||
loader: Optional[SourceLoader] = ...,
|
loader: Optional[SourceLoader] = ...,
|
||||||
module_name: Optional[str] = None,
|
module_name: Optional[str] = ...,
|
||||||
): ...
|
): ...
|
||||||
|
|
||||||
def technical_404_response(request: HttpRequest, exception: Http404) -> HttpResponse: ...
|
def technical_404_response(request: HttpRequest, exception: Http404) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Callable
|
||||||
|
|
||||||
def xframe_options_deny(view_func: Callable) -> Callable: ...
|
def xframe_options_deny(view_func: Callable) -> Callable: ...
|
||||||
def xframe_options_sameorigin(view_func: Callable) -> Callable: ...
|
def xframe_options_sameorigin(view_func: Callable) -> Callable: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable
|
||||||
|
|
||||||
from django.middleware.csrf import CsrfViewMiddleware
|
from django.middleware.csrf import CsrfViewMiddleware
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable
|
||||||
|
|
||||||
def sensitive_variables(*variables: Any) -> Callable: ...
|
def sensitive_variables(*variables: Any) -> Callable: ...
|
||||||
def sensitive_post_parameters(*parameters: Any) -> Callable: ...
|
def sensitive_post_parameters(*parameters: Any) -> Callable: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable
|
||||||
|
|
||||||
def vary_on_headers(*headers: Any) -> Callable: ...
|
def vary_on_headers(*headers: Any) -> Callable: ...
|
||||||
def vary_on_cookie(func: Callable) -> Callable: ...
|
def vary_on_cookie(func: Callable) -> Callable: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Optional
|
from typing import Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.http.response import (
|
from django.http.response import (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from django.views.generic.base import RedirectView as RedirectView, TemplateView as TemplateView, View as View
|
from .base import RedirectView as RedirectView, TemplateView as TemplateView, View as View
|
||||||
from django.views.generic.dates import (
|
from .dates import (
|
||||||
ArchiveIndexView as ArchiveIndexView,
|
ArchiveIndexView as ArchiveIndexView,
|
||||||
DateDetailView as DateDetailView,
|
DateDetailView as DateDetailView,
|
||||||
DayArchiveView as DayArchiveView,
|
DayArchiveView as DayArchiveView,
|
||||||
@@ -8,13 +8,8 @@ from django.views.generic.dates import (
|
|||||||
WeekArchiveView as WeekArchiveView,
|
WeekArchiveView as WeekArchiveView,
|
||||||
YearArchiveView as YearArchiveView,
|
YearArchiveView as YearArchiveView,
|
||||||
)
|
)
|
||||||
from django.views.generic.detail import DetailView as DetailView
|
from .detail import DetailView as DetailView
|
||||||
from django.views.generic.edit import (
|
from .edit import CreateView as CreateView, DeleteView as DeleteView, FormView as FormView, UpdateView as UpdateView
|
||||||
CreateView as CreateView,
|
from .list import ListView as ListView
|
||||||
DeleteView as DeleteView,
|
|
||||||
FormView as FormView,
|
|
||||||
UpdateView as UpdateView,
|
|
||||||
)
|
|
||||||
from django.views.generic.list import ListView as ListView
|
|
||||||
|
|
||||||
class GenericViewError(Exception): ...
|
class GenericViewError(Exception): ...
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ class RedirectView(View):
|
|||||||
def get(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
def get(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def head(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
def head(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def post(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
def post(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def options(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
|
||||||
def delete(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
def delete(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def put(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
def put(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def patch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
def patch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
|
|||||||
@@ -8,49 +8,49 @@ from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResp
|
|||||||
from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin
|
from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin
|
||||||
|
|
||||||
class YearMixin:
|
class YearMixin:
|
||||||
year_format = ... # type: str
|
year_format: str = ...
|
||||||
year = ... # type: Optional[str]
|
year: Optional[str] = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
def get_year_format(self) -> str: ...
|
def get_year_format(self) -> str: ...
|
||||||
def get_year(self) -> str: ...
|
def get_year(self) -> str: ...
|
||||||
def get_next_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class MonthMixin:
|
class MonthMixin:
|
||||||
month_format = ... # type: str
|
month_format: str = ...
|
||||||
month = ... # type: Optional[str]
|
month: Optional[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_month_format(self) -> str: ...
|
def get_month_format(self) -> str: ...
|
||||||
def get_month(self) -> str: ...
|
def get_month(self) -> str: ...
|
||||||
def get_next_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class DayMixin:
|
class DayMixin:
|
||||||
day_format = ... # type: str
|
day_format: str = ...
|
||||||
day = ... # type: Optional[str]
|
day: Optional[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_day_format(self) -> str: ...
|
def get_day_format(self) -> str: ...
|
||||||
def get_day(self) -> str: ...
|
def get_day(self) -> str: ...
|
||||||
def get_next_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class WeekMixin:
|
class WeekMixin:
|
||||||
week_format = ... # type: str
|
week_format: str = ...
|
||||||
week = ... # type: Optional[str]
|
week: Optional[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_week_format(self) -> str: ...
|
def get_week_format(self) -> str: ...
|
||||||
def get_week(self) -> str: ...
|
def get_week(self) -> str: ...
|
||||||
def get_next_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class DateMixin:
|
class DateMixin:
|
||||||
date_field = ... # type: Optional[str]
|
date_field: Optional[str] = ...
|
||||||
allow_future = ... # type: bool
|
allow_future: bool = ...
|
||||||
model = ... # type: Optional[Type[models.Model]]
|
model: Optional[Type[models.Model]] = ...
|
||||||
def get_date_field(self) -> str: ...
|
def get_date_field(self) -> str: ...
|
||||||
def get_allow_future(self) -> bool: ...
|
def get_allow_future(self) -> bool: ...
|
||||||
def uses_datetime_field(self) -> bool: ...
|
def uses_datetime_field(self) -> bool: ...
|
||||||
@@ -58,63 +58,33 @@ class DateMixin:
|
|||||||
DatedItems = Tuple[Optional[Sequence[datetime.date]], Sequence[object], Dict[str, Any]]
|
DatedItems = Tuple[Optional[Sequence[datetime.date]], Sequence[object], Dict[str, Any]]
|
||||||
|
|
||||||
class BaseDateListView(MultipleObjectMixin, DateMixin, View):
|
class BaseDateListView(MultipleObjectMixin, DateMixin, View):
|
||||||
allow_empty = ... # type: bool
|
date_list_period: str = ...
|
||||||
date_list_period = ... # type: str
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
def get_dated_items(self) -> DatedItems: ...
|
||||||
def get_ordering(self) -> Sequence[str]: ...
|
def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet: ...
|
||||||
def get_dated_queryset(self, **lookup: object) -> models.query.QuerySet: ...
|
|
||||||
def get_date_list_period(self) -> str: ...
|
def get_date_list_period(self) -> str: ...
|
||||||
def get_date_list(
|
def get_date_list(
|
||||||
self, queryset: models.query.QuerySet, date_type: str = None, ordering: str = ...
|
self, queryset: models.query.QuerySet, date_type: Optional[str] = ..., ordering: str = ...
|
||||||
) -> models.query.QuerySet: ...
|
) -> models.query.QuerySet: ...
|
||||||
|
|
||||||
class BaseArchiveIndexView(BaseDateListView):
|
class BaseArchiveIndexView(BaseDateListView): ...
|
||||||
context_object_name = ... # type: str
|
class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView): ...
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseYearArchiveView(YearMixin, BaseDateListView):
|
class BaseYearArchiveView(YearMixin, BaseDateListView):
|
||||||
date_list_period = ... # type: str
|
make_object_list: bool = ...
|
||||||
make_object_list = ... # type: bool
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
def get_make_object_list(self) -> bool: ...
|
def get_make_object_list(self) -> bool: ...
|
||||||
|
|
||||||
class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView):
|
class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView): ...
|
||||||
template_name_suffix = ... # type: str
|
class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView): ...
|
||||||
|
class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView): ...
|
||||||
class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView):
|
class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView): ...
|
||||||
date_list_period = ... # type: str
|
class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView): ...
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView): ...
|
||||||
|
class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView): ...
|
||||||
class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView):
|
class BaseTodayArchiveView(BaseDayArchiveView): ...
|
||||||
template_name_suffix = ... # type: str
|
class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView): ...
|
||||||
|
class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView): ...
|
||||||
class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView):
|
class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView): ...
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView):
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseTodayArchiveView(BaseDayArchiveView):
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView):
|
|
||||||
def get_object(self, queryset: models.query.QuerySet = None) -> models.Model: ...
|
|
||||||
|
|
||||||
class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
def timezone_today() -> datetime.date: ...
|
def timezone_today() -> datetime.date: ...
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
from typing import Any, Dict, List, Optional, Type
|
from typing import Any, Dict, Optional, Type
|
||||||
|
|
||||||
|
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http import HttpResponse, HttpRequest
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
|
||||||
|
|
||||||
class SingleObjectMixin(ContextMixin):
|
class SingleObjectMixin(ContextMixin):
|
||||||
model: Optional[Type[models.Model]] = ...
|
model: Optional[Type[models.Model]] = ...
|
||||||
@@ -14,11 +15,10 @@ class SingleObjectMixin(ContextMixin):
|
|||||||
query_pk_and_slug: bool = ...
|
query_pk_and_slug: bool = ...
|
||||||
object: models.Model = ...
|
object: models.Model = ...
|
||||||
kwargs: Dict[str, Any] = ...
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_object(self, queryset: Optional[models.query.QuerySet] = None) -> models.Model: ...
|
def get_object(self, queryset: Optional[models.query.QuerySet] = ...) -> models.Model: ...
|
||||||
def get_queryset(self) -> models.query.QuerySet: ...
|
def get_queryset(self) -> models.query.QuerySet: ...
|
||||||
def get_slug_field(self) -> str: ...
|
def get_slug_field(self) -> str: ...
|
||||||
def get_context_object_name(self, obj: Any) -> Optional[str]: ...
|
def get_context_object_name(self, obj: Any) -> Optional[str]: ...
|
||||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
|
||||||
|
|
||||||
class BaseDetailView(SingleObjectMixin, View):
|
class BaseDetailView(SingleObjectMixin, View):
|
||||||
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
@@ -29,6 +29,5 @@ class SingleObjectTemplateResponseMixin(TemplateResponseMixin):
|
|||||||
template_name_suffix: str = ...
|
template_name_suffix: str = ...
|
||||||
model: Optional[Type[models.Model]] = ...
|
model: Optional[Type[models.Model]] = ...
|
||||||
object: models.Model = ...
|
object: models.Model = ...
|
||||||
def get_template_names(self) -> List[str]: ...
|
|
||||||
|
|
||||||
class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView): ...
|
class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView): ...
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type
|
from typing import Any, Dict, Optional, Sequence, Tuple, Type
|
||||||
|
|
||||||
from django.db.models import Model
|
from django.core.paginator import Paginator
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.core.paginator import Paginator # type: ignore # This will be fixed when adding the paginator module
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
|
||||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||||
|
|
||||||
|
from django.db.models import Model
|
||||||
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
class MultipleObjectMixin(ContextMixin):
|
class MultipleObjectMixin(ContextMixin):
|
||||||
allow_empty = ... # type: bool
|
allow_empty: bool = ...
|
||||||
queryset = ... # type: Optional[QuerySet]
|
queryset: Optional[QuerySet] = ...
|
||||||
model = ... # type: Optional[Type[Model]]
|
model: Optional[Type[Model]] = ...
|
||||||
paginate_by = ... # type: Optional[int]
|
paginate_by: Optional[int] = ...
|
||||||
paginate_orphans = ... # type: int
|
paginate_orphans: int = ...
|
||||||
context_object_name = ... # type: Optional[str]
|
context_object_name: Optional[str] = ...
|
||||||
paginator_class = ... # type: Type[Paginator]
|
paginator_class: Type[Paginator] = ...
|
||||||
page_kwarg = ... # type: str
|
page_kwarg: str = ...
|
||||||
ordering = ... # type: Sequence[str]
|
ordering: Sequence[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
object_list = ... # type: QuerySet
|
object_list: QuerySet = ...
|
||||||
def get_queryset(self) -> QuerySet: ...
|
def get_queryset(self) -> QuerySet: ...
|
||||||
def get_ordering(self) -> Sequence[str]: ...
|
def get_ordering(self) -> Sequence[str]: ...
|
||||||
def paginate_queryset(self, queryset: QuerySet, page_size: int) -> Tuple[Paginator, int, QuerySet, bool]: ...
|
def paginate_queryset(self, queryset: QuerySet, page_size: int) -> Tuple[Paginator, int, QuerySet, bool]: ...
|
||||||
@@ -29,16 +30,13 @@ class MultipleObjectMixin(ContextMixin):
|
|||||||
def get_paginate_orphans(self) -> int: ...
|
def get_paginate_orphans(self) -> int: ...
|
||||||
def get_allow_empty(self) -> bool: ...
|
def get_allow_empty(self) -> bool: ...
|
||||||
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
||||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
|
||||||
|
|
||||||
class BaseListView(MultipleObjectMixin, View):
|
class BaseListView(MultipleObjectMixin, View):
|
||||||
object_list = ... # type: QuerySet
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
|
class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
|
||||||
template_name_suffix = ... # type: str
|
template_name_suffix: str = ...
|
||||||
object_list = ... # type: QuerySet
|
object_list: QuerySet = ...
|
||||||
def get_template_names(self) -> List[str]: ...
|
|
||||||
|
|
||||||
class ListView(MultipleObjectTemplateResponseMixin, BaseListView): ...
|
class ListView(MultipleObjectTemplateResponseMixin, BaseListView): ...
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Callable, Dict, List, Optional, Union
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
|
from django.utils.translation.trans_real import DjangoTranslation
|
||||||
|
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
|
|
||||||
LANGUAGE_QUERY_PARAMETER: str
|
LANGUAGE_QUERY_PARAMETER: str
|
||||||
|
|
||||||
def set_language(request: WSGIRequest) -> HttpResponse: ...
|
def set_language(request: HttpRequest) -> HttpResponse: ...
|
||||||
def get_formats() -> Dict[str, Union[List[str], int, str]]: ...
|
def get_formats() -> Dict[str, Union[List[str], int, str]]: ...
|
||||||
|
|
||||||
js_catalog_template: str
|
js_catalog_template: str
|
||||||
@@ -15,21 +17,15 @@ def render_javascript_catalog(catalog: Optional[Any] = ..., plural: Optional[Any
|
|||||||
def null_javascript_catalog(request: Any, domain: Optional[Any] = ..., packages: Optional[Any] = ...): ...
|
def null_javascript_catalog(request: Any, domain: Optional[Any] = ..., packages: Optional[Any] = ...): ...
|
||||||
|
|
||||||
class JavaScriptCatalog(View):
|
class JavaScriptCatalog(View):
|
||||||
args: Tuple
|
|
||||||
head: Callable
|
head: Callable
|
||||||
kwargs: Dict[Any, Any]
|
|
||||||
request: WSGIRequest
|
|
||||||
domain: str = ...
|
domain: str = ...
|
||||||
packages: List[str] = ...
|
packages: List[str] = ...
|
||||||
translation: django.utils.translation.trans_real.DjangoTranslation = ...
|
translation: DjangoTranslation = ...
|
||||||
def get(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get_paths(self, packages: List[str]) -> List[str]: ...
|
def get_paths(self, packages: List[str]) -> List[str]: ...
|
||||||
def get_plural(self) -> None: ...
|
def get_plural(self) -> None: ...
|
||||||
def get_catalog(self) -> Dict[str, Union[List[str], str]]: ...
|
def get_catalog(self) -> Dict[str, Union[List[str], str]]: ...
|
||||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Optional[Dict[str, Union[List[str], int, str]]]]: ...
|
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
def render_to_response(
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
self, context: Dict[str, Optional[Dict[str, Union[List[str], int, str]]]], **response_kwargs: Any
|
|
||||||
) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class JSONCatalog(JavaScriptCatalog):
|
class JSONCatalog(JavaScriptCatalog): ...
|
||||||
def render_to_response(self, context: Any, **response_kwargs: Any): ...
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import FileResponse
|
from django.http.response import FileResponse
|
||||||
|
|
||||||
def serve(request: WSGIRequest, path: str, document_root: str = ..., show_indexes: bool = ...) -> FileResponse: ...
|
def serve(request: HttpRequest, path: str, document_root: str = ..., show_indexes: bool = ...) -> FileResponse: ...
|
||||||
|
|
||||||
DEFAULT_DIRECTORY_INDEX_TEMPLATE: str
|
DEFAULT_DIRECTORY_INDEX_TEMPLATE: str
|
||||||
template_translatable: Any
|
template_translatable: Any
|
||||||
|
|||||||
Reference in New Issue
Block a user