1import datetime 2from typing import Any, Dict, Optional, Sequence, Tuple 3 4from django.views.generic.base import View 5from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin 6from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin 7 8from django.db import models 9from django.http import HttpRequest, HttpResponse 10 11class YearMixin: 12 year_format: str = ... 13 year: Optional[str] = ... 14 def get_year_format(self) -> str: ... 15 def get_year(self) -> str: ... 16 def get_next_year(self, date: datetime.date) -> Optional[datetime.date]: ... 17 def get_previous_year(self, date: datetime.date) -> Optional[datetime.date]: ... 18 19class MonthMixin: 20 month_format: str = ... 21 month: Optional[str] = ... 22 def get_month_format(self) -> str: ... 23 def get_month(self) -> str: ... 24 def get_next_month(self, date: datetime.date) -> Optional[datetime.date]: ... 25 def get_previous_month(self, date: datetime.date) -> Optional[datetime.date]: ... 26 27class DayMixin: 28 day_format: str = ... 29 day: Optional[str] = ... 30 def get_day_format(self) -> str: ... 31 def get_day(self) -> str: ... 32 def get_next_day(self, date: datetime.date) -> Optional[datetime.date]: ... 33 def get_previous_day(self, date: datetime.date) -> Optional[datetime.date]: ... 34 35class WeekMixin: 36 week_format: str = ... 37 week: Optional[str] = ... 38 def get_week_format(self) -> str: ... 39 def get_week(self) -> str: ... 40 def get_next_week(self, date: datetime.date) -> Optional[datetime.date]: ... 41 def get_previous_week(self, date: datetime.date) -> Optional[datetime.date]: ... 42 43class DateMixin: 44 date_field: Optional[str] = ... 45 allow_future: bool = ... 46 def get_date_field(self) -> str: ... 47 def get_allow_future(self) -> bool: ... 48 def uses_datetime_field(self) -> bool: ... 49 50DatedItems = Tuple[Optional[Sequence[datetime.date]], Sequence[object], Dict[str, Any]] 51 52class BaseDateListView(MultipleObjectMixin, DateMixin, View): 53 date_list_period: str = ... 54 def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... 55 def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... 56 def get_dated_items(self) -> DatedItems: ... 57 def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet: ... 58 def get_date_list_period(self) -> str: ... 59 def get_date_list( 60 self, queryset: models.query.QuerySet, date_type: Optional[str] = ..., ordering: str = ... 61 ) -> models.query.QuerySet: ... 62 63class BaseArchiveIndexView(BaseDateListView): ... 64class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView): ... 65 66class BaseYearArchiveView(YearMixin, BaseDateListView): 67 make_object_list: bool = ... 68 def get_make_object_list(self) -> bool: ... 69 70class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView): ... 71class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView): ... 72class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView): ... 73class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView): ... 74class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView): ... 75class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView): ... 76class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView): ... 77class BaseTodayArchiveView(BaseDayArchiveView): ... 78class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView): ... 79class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView): ... 80class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView): ... 81 82def timezone_today() -> datetime.date: ... 83