mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 04:54:48 +08:00
33 lines
1.3 KiB
Python
33 lines
1.3 KiB
Python
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): ...
|