mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-03-06 23:24:27 +08:00
move generated stubs to separate directory, too messty
This commit is contained in:
0
django-stubs-generated/views/generic/__init__.pyi
Normal file
0
django-stubs-generated/views/generic/__init__.pyi
Normal file
103
django-stubs-generated/views/generic/base.pyi
Normal file
103
django-stubs-generated/views/generic/base.pyi
Normal file
@@ -0,0 +1,103 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Union
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.paginator import Page, Paginator
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import (HttpResponse, HttpResponseNotAllowed,
|
||||
HttpResponseRedirect)
|
||||
from django.template.response import TemplateResponse
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
logger: Any
|
||||
|
||||
class ContextMixin:
|
||||
extra_context: Any = ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
|
||||
class View:
|
||||
http_method_names: Any = ...
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
head: Any = ...
|
||||
request: Any = ...
|
||||
args: Any = ...
|
||||
kwargs: Any = ...
|
||||
def as_view(cls, **initkwargs: Any) -> Callable: ...
|
||||
def dispatch(
|
||||
self, request: HttpRequest, *args: Any, **kwargs: Any
|
||||
) -> Union[HttpResponse, View]: ...
|
||||
def http_method_not_allowed(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseNotAllowed: ...
|
||||
def options(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class TemplateResponseMixin:
|
||||
template_name: Any = ...
|
||||
template_engine: Any = ...
|
||||
response_class: Any = ...
|
||||
content_type: Any = ...
|
||||
def render_to_response(
|
||||
self,
|
||||
context: Union[
|
||||
Dict[str, Any],
|
||||
Dict[str, Optional[Union[List[Dict[str, str]], bool, ListView]]],
|
||||
Dict[
|
||||
str,
|
||||
Union[List[Dict[str, str]], bool, Page, Paginator, ListView],
|
||||
],
|
||||
Dict[
|
||||
str, Union[AuthenticationForm, Site, TemplateResponseMixin, str]
|
||||
],
|
||||
MagicMock,
|
||||
],
|
||||
**response_kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
def get_template_names(self) -> List[str]: ...
|
||||
|
||||
class TemplateView(TemplateResponseMixin, ContextMixin, View):
|
||||
args: Tuple
|
||||
content_type: str
|
||||
extra_context: Dict[str, str]
|
||||
head: Callable
|
||||
kwargs: Dict[str, str]
|
||||
request: django.core.handlers.wsgi.WSGIRequest
|
||||
template_engine: str
|
||||
template_name: str
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
class RedirectView(View):
|
||||
args: Tuple
|
||||
kwargs: Dict[str, Union[int, str]]
|
||||
request: django.core.handlers.wsgi.WSGIRequest
|
||||
permanent: bool = ...
|
||||
url: str = ...
|
||||
pattern_name: str = ...
|
||||
query_string: bool = ...
|
||||
def get_redirect_url(self, *args: Any, **kwargs: Any) -> Optional[str]: ...
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
def head(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
def post(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect: ...
|
||||
def options(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect: ...
|
||||
def delete(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect: ...
|
||||
def put(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect: ...
|
||||
def patch(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect: ...
|
||||
133
django-stubs-generated/views/generic/dates.pyi
Normal file
133
django-stubs-generated/views/generic/dates.pyi
Normal file
@@ -0,0 +1,133 @@
|
||||
from datetime import date
|
||||
from typing import Any, Dict, Optional, Tuple, Union
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.template.response import TemplateResponse
|
||||
from django.views.generic.base import View
|
||||
from django.views.generic.detail import (BaseDetailView,
|
||||
SingleObjectTemplateResponseMixin)
|
||||
from django.views.generic.list import (MultipleObjectMixin,
|
||||
MultipleObjectTemplateResponseMixin)
|
||||
|
||||
|
||||
class YearMixin:
|
||||
year_format: str = ...
|
||||
year: Any = ...
|
||||
def get_year_format(self) -> str: ...
|
||||
def get_year(self) -> int: ...
|
||||
def get_next_year(self, date: date) -> Optional[date]: ...
|
||||
def get_previous_year(self, date: date) -> Optional[date]: ...
|
||||
|
||||
class MonthMixin:
|
||||
month_format: str = ...
|
||||
month: Any = ...
|
||||
def get_month_format(self) -> str: ...
|
||||
def get_month(self) -> Union[int, str]: ...
|
||||
def get_next_month(self, date: date) -> Optional[date]: ...
|
||||
def get_previous_month(self, date: date) -> Optional[date]: ...
|
||||
|
||||
class DayMixin:
|
||||
day_format: str = ...
|
||||
day: Any = ...
|
||||
def get_day_format(self) -> str: ...
|
||||
def get_day(self) -> Union[int, str]: ...
|
||||
def get_next_day(self, date: date) -> Optional[date]: ...
|
||||
def get_previous_day(self, date: date) -> Optional[date]: ...
|
||||
|
||||
class WeekMixin:
|
||||
week_format: str = ...
|
||||
week: Any = ...
|
||||
def get_week_format(self) -> str: ...
|
||||
def get_week(self) -> int: ...
|
||||
def get_next_week(self, date: date) -> Optional[date]: ...
|
||||
def get_previous_week(self, date: date) -> Optional[date]: ...
|
||||
|
||||
class DateMixin:
|
||||
date_field: Any = ...
|
||||
allow_future: bool = ...
|
||||
def get_date_field(self) -> str: ...
|
||||
def get_allow_future(self) -> bool: ...
|
||||
def uses_datetime_field(self) -> bool: ...
|
||||
|
||||
class BaseDateListView(MultipleObjectMixin, DateMixin, View):
|
||||
allow_empty: bool = ...
|
||||
date_list_period: str = ...
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
def get_dated_items(self) -> None: ...
|
||||
def get_ordering(self) -> Union[Tuple[str, str], str]: ...
|
||||
def get_dated_queryset(self, **lookup: Any) -> QuerySet: ...
|
||||
def get_date_list_period(self) -> str: ...
|
||||
def get_date_list(
|
||||
self, queryset: QuerySet, date_type: None = ..., ordering: str = ...
|
||||
) -> QuerySet: ...
|
||||
|
||||
class BaseArchiveIndexView(BaseDateListView):
|
||||
context_object_name: str = ...
|
||||
def get_dated_items(self) -> Tuple[QuerySet, QuerySet, Dict[Any, Any]]: ...
|
||||
|
||||
class ArchiveIndexView(
|
||||
MultipleObjectTemplateResponseMixin, BaseArchiveIndexView
|
||||
):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class BaseYearArchiveView(YearMixin, BaseDateListView):
|
||||
date_list_period: str = ...
|
||||
make_object_list: bool = ...
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Tuple[QuerySet, QuerySet, Dict[str, Optional[date]]]: ...
|
||||
def get_make_object_list(self) -> bool: ...
|
||||
|
||||
class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView):
|
||||
date_list_period: str = ...
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Tuple[QuerySet, QuerySet, Dict[str, Optional[date]]]: ...
|
||||
|
||||
class MonthArchiveView(
|
||||
MultipleObjectTemplateResponseMixin, BaseMonthArchiveView
|
||||
):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView):
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Tuple[None, QuerySet, Dict[str, Optional[date]]]: ...
|
||||
|
||||
class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView):
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Tuple[None, QuerySet, Dict[str, Optional[date]]]: ...
|
||||
|
||||
class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class BaseTodayArchiveView(BaseDayArchiveView):
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Tuple[None, QuerySet, Dict[str, Optional[date]]]: ...
|
||||
|
||||
class TodayArchiveView(
|
||||
MultipleObjectTemplateResponseMixin, BaseTodayArchiveView
|
||||
):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class BaseDateDetailView(
|
||||
YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView
|
||||
):
|
||||
def get_object(self, queryset: Optional[QuerySet] = ...) -> Model: ...
|
||||
|
||||
class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
def timezone_today() -> date: ...
|
||||
37
django-stubs-generated/views/generic/detail.pyi
Normal file
37
django-stubs-generated/views/generic/detail.pyi
Normal file
@@ -0,0 +1,37 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.template.response import TemplateResponse
|
||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||
|
||||
|
||||
class SingleObjectMixin(ContextMixin):
|
||||
model: Any = ...
|
||||
queryset: Any = ...
|
||||
slug_field: str = ...
|
||||
context_object_name: Any = ...
|
||||
slug_url_kwarg: str = ...
|
||||
pk_url_kwarg: str = ...
|
||||
query_pk_and_slug: bool = ...
|
||||
def get_object(self, queryset: Optional[QuerySet] = ...) -> Model: ...
|
||||
def get_queryset(self) -> QuerySet: ...
|
||||
def get_slug_field(self) -> str: ...
|
||||
def get_context_object_name(
|
||||
self, obj: Union[Dict[str, str], Model]
|
||||
) -> Optional[str]: ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
|
||||
class BaseDetailView(SingleObjectMixin, View):
|
||||
object: Any = ...
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
class SingleObjectTemplateResponseMixin(TemplateResponseMixin):
|
||||
template_name_field: Any = ...
|
||||
template_name_suffix: str = ...
|
||||
def get_template_names(self) -> List[str]: ...
|
||||
|
||||
class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView): ...
|
||||
96
django-stubs-generated/views/generic/edit.pyi
Normal file
96
django-stubs-generated/views/generic/edit.pyi
Normal file
@@ -0,0 +1,96 @@
|
||||
from typing import Any, Dict, Optional, Type, Union
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.forms.forms import BaseForm, Form
|
||||
from django.forms.models import ModelForm
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||
from django.views.generic.detail import (BaseDetailView, SingleObjectMixin,
|
||||
SingleObjectTemplateResponseMixin)
|
||||
|
||||
|
||||
class FormMixin(ContextMixin):
|
||||
initial: Any = ...
|
||||
form_class: Any = ...
|
||||
success_url: Any = ...
|
||||
prefix: Any = ...
|
||||
def get_initial(self) -> Dict[Any, Any]: ...
|
||||
def get_prefix(self) -> None: ...
|
||||
def get_form_class(self) -> Type[Form]: ...
|
||||
def get_form(self, form_class: None = ...) -> BaseForm: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[str, Optional[Union[Dict[str, str], MultiValueDict]]]: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
def form_valid(self, form: BaseForm) -> HttpResponseRedirect: ...
|
||||
def form_invalid(self, form: Form) -> TemplateResponse: ...
|
||||
def get_context_data(
|
||||
self, **kwargs: Any
|
||||
) -> Dict[str, Union[Model, BaseForm, TemplateResponseMixin]]: ...
|
||||
|
||||
class ModelFormMixin(FormMixin, SingleObjectMixin):
|
||||
request: django.core.handlers.wsgi.WSGIRequest
|
||||
fields: Any = ...
|
||||
def get_form_class(self) -> Type[ModelForm]: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[str, Optional[Union[Dict[Any, Any], Model, MultiValueDict]]]: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
object: Any = ...
|
||||
def form_valid(self, form: ModelForm) -> HttpResponseRedirect: ...
|
||||
|
||||
class ProcessFormView(View):
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
def post(
|
||||
self, request: HttpRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
def put(self, *args: Any, **kwargs: Any): ...
|
||||
|
||||
class BaseFormView(FormMixin, ProcessFormView): ...
|
||||
class FormView(TemplateResponseMixin, BaseFormView): ...
|
||||
|
||||
class BaseCreateView(ModelFormMixin, ProcessFormView):
|
||||
object: Any = ...
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
def post(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class BaseUpdateView(ModelFormMixin, ProcessFormView):
|
||||
object: Any = ...
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
def post(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView):
|
||||
template_name_suffix: str = ...
|
||||
|
||||
class DeletionMixin:
|
||||
success_url: Any = ...
|
||||
object: Any = ...
|
||||
def delete(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect: ...
|
||||
def post(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
|
||||
class BaseDeleteView(DeletionMixin, BaseDetailView): ...
|
||||
|
||||
class DeleteView(SingleObjectTemplateResponseMixin, BaseDeleteView):
|
||||
template_name_suffix: str = ...
|
||||
57
django-stubs-generated/views/generic/list.pyi
Normal file
57
django-stubs-generated/views/generic/list.pyi
Normal file
@@ -0,0 +1,57 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.paginator import Page, Paginator
|
||||
from django.db.models.query import QuerySet
|
||||
from django.template.response import TemplateResponse
|
||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||
|
||||
|
||||
class MultipleObjectMixin(ContextMixin):
|
||||
allow_empty: bool = ...
|
||||
queryset: Any = ...
|
||||
model: Any = ...
|
||||
paginate_by: Any = ...
|
||||
paginate_orphans: int = ...
|
||||
context_object_name: Any = ...
|
||||
paginator_class: Any = ...
|
||||
page_kwarg: str = ...
|
||||
ordering: Any = ...
|
||||
def get_queryset(self) -> Union[List[Dict[str, str]], QuerySet]: ...
|
||||
def get_ordering(self) -> Optional[Union[Tuple[str, str], str]]: ...
|
||||
def paginate_queryset(
|
||||
self, queryset: Union[List[Dict[str, str]], QuerySet], page_size: int
|
||||
) -> Tuple[
|
||||
Paginator, Page, Union[List[Dict[str, str]], QuerySet], bool
|
||||
]: ...
|
||||
def get_paginate_by(
|
||||
self, queryset: Optional[Union[List[Dict[str, str]], QuerySet]]
|
||||
) -> Optional[int]: ...
|
||||
def get_paginator(
|
||||
self,
|
||||
queryset: Union[List[Dict[str, str]], QuerySet],
|
||||
per_page: int,
|
||||
orphans: int = ...,
|
||||
allow_empty_first_page: bool = ...,
|
||||
**kwargs: Any
|
||||
) -> Paginator: ...
|
||||
def get_paginate_orphans(self) -> int: ...
|
||||
def get_allow_empty(self) -> bool: ...
|
||||
def get_context_object_name(
|
||||
self, object_list: Optional[Union[List[Dict[str, str]], QuerySet]]
|
||||
) -> Optional[str]: ...
|
||||
def get_context_data(
|
||||
self, *, object_list: Optional[Any] = ..., **kwargs: Any
|
||||
) -> Dict[str, Any]: ...
|
||||
|
||||
class BaseListView(MultipleObjectMixin, View):
|
||||
object_list: Any = ...
|
||||
def get(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
|
||||
template_name_suffix: str = ...
|
||||
def get_template_names(self) -> List[str]: ...
|
||||
|
||||
class ListView(MultipleObjectTemplateResponseMixin, BaseListView): ...
|
||||
Reference in New Issue
Block a user