diff --git a/django-stubs/views/generic/dates.pyi b/django-stubs/views/generic/dates.pyi index 1a92a6315..195498170 100644 --- a/django-stubs/views/generic/dates.pyi +++ b/django-stubs/views/generic/dates.pyi @@ -1,17 +1,16 @@ import datetime -from typing import Any, Dict, Optional, Sequence, Tuple, Type +from typing import Any, Dict, Optional, Sequence, Tuple -from django.db import models -from django.http import HttpRequest, HttpResponse from django.views.generic.base import View from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin +from django.db import models +from django.http import HttpRequest, HttpResponse + class YearMixin: year_format: str = ... year: Optional[str] = ... - kwargs: Dict[str, Any] = ... - request: HttpRequest = ... def get_year_format(self) -> str: ... def get_year(self) -> str: ... def get_next_year(self, date: datetime.date) -> Optional[datetime.date]: ... @@ -20,8 +19,6 @@ class YearMixin: class MonthMixin: month_format: str = ... month: Optional[str] = ... - request: HttpRequest = ... - kwargs: Dict[str, Any] = ... def get_month_format(self) -> str: ... def get_month(self) -> str: ... def get_next_month(self, date: datetime.date) -> Optional[datetime.date]: ... @@ -30,8 +27,6 @@ class MonthMixin: class DayMixin: day_format: str = ... day: Optional[str] = ... - request: HttpRequest = ... - kwargs: Dict[str, Any] = ... def get_day_format(self) -> str: ... def get_day(self) -> str: ... def get_next_day(self, date: datetime.date) -> Optional[datetime.date]: ... @@ -40,8 +35,6 @@ class DayMixin: class WeekMixin: week_format: str = ... week: Optional[str] = ... - request: HttpRequest = ... - kwargs: Dict[str, Any] = ... def get_week_format(self) -> str: ... def get_week(self) -> str: ... def get_next_week(self, date: datetime.date) -> Optional[datetime.date]: ... @@ -50,7 +43,6 @@ class WeekMixin: class DateMixin: date_field: Optional[str] = ... allow_future: bool = ... - model: Optional[Type[models.Model]] = ... def get_date_field(self) -> str: ... def get_allow_future(self) -> bool: ... def uses_datetime_field(self) -> bool: ... diff --git a/django-stubs/views/generic/detail.pyi b/django-stubs/views/generic/detail.pyi index 95ee1291b..70229eace 100644 --- a/django-stubs/views/generic/detail.pyi +++ b/django-stubs/views/generic/detail.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Optional, Type +from typing import Any, Optional, Type from django.views.generic.base import ContextMixin, TemplateResponseMixin, View @@ -6,28 +6,23 @@ from django.db import models from django.http import HttpRequest, HttpResponse class SingleObjectMixin(ContextMixin): - model: Optional[Type[models.Model]] = ... - queryset: Optional[models.query.QuerySet] = ... + model: Type[models.Model] = ... + queryset: models.query.QuerySet = ... slug_field: str = ... - context_object_name: Optional[str] = ... + context_object_name: str = ... slug_url_kwarg: str = ... pk_url_kwarg: str = ... query_pk_and_slug: bool = ... - object: models.Model = ... - kwargs: Dict[str, Any] = ... def get_object(self, queryset: Optional[models.query.QuerySet] = ...) -> models.Model: ... def get_queryset(self) -> models.query.QuerySet: ... def get_slug_field(self) -> str: ... def get_context_object_name(self, obj: Any) -> Optional[str]: ... class BaseDetailView(SingleObjectMixin, View): - def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... class SingleObjectTemplateResponseMixin(TemplateResponseMixin): template_name_field: Optional[str] = ... template_name_suffix: str = ... - model: Optional[Type[models.Model]] = ... - object: models.Model = ... class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView): ... diff --git a/django-stubs/views/generic/edit.pyi b/django-stubs/views/generic/edit.pyi index a8c5e1542..ef3a23d52 100644 --- a/django-stubs/views/generic/edit.pyi +++ b/django-stubs/views/generic/edit.pyi @@ -1,6 +1,5 @@ from typing import Any, Callable, Dict, Optional, Sequence, Type, Union -from django.db import models from django.forms.forms import BaseForm from django.http import HttpRequest, HttpResponse from django.views.generic.base import ContextMixin, TemplateResponseMixin, View @@ -12,8 +11,6 @@ class FormMixin(ContextMixin): form_class: Optional[Type[BaseForm]] = ... success_url: Optional[Union[str, Callable[..., Any]]] = ... prefix: Optional[str] = ... - request: HttpRequest = ... - def render_to_response(self, context: Dict[str, Any], **response_kwargs: object) -> HttpResponse: ... def get_initial(self) -> Dict[str, Any]: ... def get_prefix(self) -> Optional[str]: ... def get_form_class(self) -> Type[BaseForm]: ... @@ -27,8 +24,6 @@ class ModelFormMixin(FormMixin, SingleObjectMixin): fields: Optional[Union[Sequence[str], Literal["__all__"]]] = ... class ProcessFormView(View): - def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... - def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ... def get(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ... def post(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ... def put(self, *args: str, **kwargs: Any) -> HttpResponse: ... @@ -40,11 +35,8 @@ class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView): ... class BaseUpdateView(ModelFormMixin, ProcessFormView): ... class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView): ... -_object = object - class DeletionMixin: success_url: Optional[str] = ... - object: models.Model = ... def post(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ... def delete(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ... def get_success_url(self) -> str: ... diff --git a/django-stubs/views/generic/list.pyi b/django-stubs/views/generic/list.pyi index 32adae804..c93379787 100644 --- a/django-stubs/views/generic/list.pyi +++ b/django-stubs/views/generic/list.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Optional, Sequence, Tuple, Type +from typing import Any, Optional, Sequence, Tuple, Type from django.core.paginator import Paginator from django.db.models.query import QuerySet, _BaseQuerySet @@ -17,9 +17,6 @@ class MultipleObjectMixin(ContextMixin): paginator_class: Type[Paginator] = ... page_kwarg: str = ... ordering: Sequence[str] = ... - request: HttpRequest = ... - kwargs: Dict[str, Any] = ... - object_list: QuerySet = ... def get_queryset(self) -> QuerySet: ... def get_ordering(self) -> Sequence[str]: ... def paginate_queryset(self, queryset: _BaseQuerySet, page_size: int) -> Tuple[Paginator, int, QuerySet, bool]: ... @@ -32,11 +29,9 @@ class MultipleObjectMixin(ContextMixin): def get_context_object_name(self, object_list: _BaseQuerySet) -> Optional[str]: ... class BaseListView(MultipleObjectMixin, View): - def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... class MultipleObjectTemplateResponseMixin(TemplateResponseMixin): template_name_suffix: str = ... - object_list: QuerySet = ... class ListView(MultipleObjectTemplateResponseMixin, BaseListView): ...