first version finished

This commit is contained in:
Maxim Kurnikov
2018-07-29 18:27:46 +03:00
parent a9f215bf64
commit c180555415
59 changed files with 2118 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
from django.core.handlers.wsgi import WSGIRequest
from django.http.response import (
HttpResponse,
HttpResponseNotAllowed,
HttpResponseRedirect,
HttpResponseRedirectBase,
)
from django.template.response import TemplateResponse
from typing import (
Any,
Callable,
Dict,
List,
Union,
)
class ContextMixin:
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
class RedirectView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> HttpResponseRedirectBase: ...
def get_redirect_url(self, *args, **kwargs) -> str: ...
def options(
self,
request: WSGIRequest,
*args,
**kwargs
) -> HttpResponseRedirect: ...
def post(
self,
request: WSGIRequest,
*args,
**kwargs
) -> HttpResponseRedirect: ...
class TemplateResponseMixin:
def get_template_names(self) -> List[str]: ...
def render_to_response(
self,
context: Dict[str, Any],
**response_kwargs
) -> TemplateResponse: ...
class TemplateView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
class View:
def __init__(self, **kwargs) -> None: ...
def _allowed_methods(self) -> List[str]: ...
@classmethod
def as_view(cls, **initkwargs) -> Callable: ...
def dispatch(
self,
request: WSGIRequest,
*args,
**kwargs
) -> Union[View, HttpResponse]: ...
def http_method_not_allowed(
self,
request: WSGIRequest,
*args,
**kwargs
) -> HttpResponseNotAllowed: ...

View File

@@ -0,0 +1,138 @@
from datetime import date
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.list import MultipleObjectTemplateResponseMixin
from typing import (
Any,
Dict,
Optional,
Tuple,
Union,
)
def _date_from_string(
year: int,
year_format: str,
month: str = ...,
month_format: str = ...,
day: Union[str, int] = ...,
day_format: str = ...,
delim: str = ...
) -> date: ...
def _get_next_prev(
generic_view: MultipleObjectTemplateResponseMixin,
date: date,
is_previous: bool,
period: str
) -> Optional[date]: ...
def timezone_today() -> date: ...
class BaseArchiveIndexView:
def get_dated_items(self) -> Tuple[QuerySet, QuerySet, Dict[Any, Any]]: ...
class BaseDateDetailView:
def get_object(self, queryset: Optional[QuerySet] = ...) -> Model: ...
class BaseDateListView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
def get_date_list(
self,
queryset: QuerySet,
date_type: None = ...,
ordering: str = ...
) -> QuerySet: ...
def get_date_list_period(self) -> str: ...
def get_dated_queryset(self, **lookup) -> QuerySet: ...
def get_ordering(self) -> Union[str, Tuple[str, str]]: ...
class BaseDayArchiveView:
def _get_dated_items(
self,
date: date
) -> Union[Tuple[None, QuerySet, Dict[str, Union[date, None]]], Tuple[None, QuerySet, Dict[str, date]]]: ...
def get_dated_items(
self
) -> Union[Tuple[None, QuerySet, Dict[str, Union[date, None]]], Tuple[None, QuerySet, Dict[str, date]]]: ...
class BaseMonthArchiveView:
def get_dated_items(
self
) -> Union[Tuple[QuerySet, QuerySet, Dict[str, Union[date, None]]], Tuple[QuerySet, QuerySet, Dict[str, date]]]: ...
class BaseTodayArchiveView:
def get_dated_items(self): ...
class BaseWeekArchiveView:
def get_dated_items(self) -> Tuple[None, QuerySet, Dict[str, date]]: ...
class BaseYearArchiveView:
def get_dated_items(
self
) -> Union[Tuple[QuerySet, QuerySet, Dict[str, Union[date, None]]], Tuple[QuerySet, QuerySet, Dict[str, date]]]: ...
def get_make_object_list(self) -> bool: ...
class DateMixin:
def _make_date_lookup_arg(self, value: date) -> date: ...
def _make_single_date_lookup(self, date: date) -> Dict[str, date]: ...
def get_allow_future(self) -> bool: ...
def get_date_field(self) -> str: ...
@cached_property
def uses_datetime_field(self) -> bool: ...
class DayMixin:
def _get_current_day(self, date: date) -> date: ...
def _get_next_day(self, date: date) -> date: ...
def get_day(self) -> int: ...
def get_day_format(self) -> str: ...
def get_next_day(self, date: date) -> None: ...
def get_previous_day(self, date: date) -> date: ...
class MonthMixin:
def _get_current_month(self, date: date) -> date: ...
def _get_next_month(self, date: date) -> date: ...
def get_month(self) -> Union[str, int]: ...
def get_month_format(self) -> str: ...
def get_next_month(self, date: date) -> Optional[date]: ...
def get_previous_month(self, date: date) -> Optional[date]: ...
class WeekMixin:
def _get_current_week(self, date: date) -> date: ...
def _get_next_week(self, date: date) -> date: ...
def _get_weekday(self, date: date) -> int: ...
def get_next_week(self, date: date) -> Optional[date]: ...
def get_previous_week(self, date: date) -> Optional[date]: ...
def get_week(self) -> int: ...
def get_week_format(self) -> str: ...
class YearMixin:
def _get_current_year(self, date: date) -> date: ...
def _get_next_year(self, date: date) -> date: ...
def get_next_year(self, date: date) -> Optional[date]: ...
def get_previous_year(self, date: date) -> Optional[date]: ...
def get_year(self) -> int: ...
def get_year_format(self) -> str: ...

View File

@@ -0,0 +1,32 @@
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 typing import (
Any,
Dict,
List,
Optional,
Union,
)
class BaseDetailView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
class SingleObjectMixin:
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
def get_context_object_name(self, obj: Union[Model, Dict[str, str]]) -> Optional[str]: ...
def get_object(self, queryset: Optional[QuerySet] = ...) -> Model: ...
def get_queryset(self) -> QuerySet: ...
def get_slug_field(self) -> str: ...
class SingleObjectTemplateResponseMixin:
def get_template_names(self) -> List[str]: ...

View File

@@ -0,0 +1,86 @@
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.response import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.utils.datastructures import MultiValueDict
from typing import (
Any,
Dict,
Optional,
Type,
Union,
)
class BaseCreateView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
class BaseUpdateView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
class DeletionMixin:
def delete(
self,
request: WSGIRequest,
*args,
**kwargs
) -> HttpResponseRedirect: ...
def get_success_url(self) -> str: ...
def post(
self,
request: WSGIRequest,
*args,
**kwargs
) -> HttpResponseRedirect: ...
class FormMixin:
def form_invalid(self, form: Form) -> TemplateResponse: ...
def form_valid(self, form: Form) -> HttpResponseRedirect: ...
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
def get_form(self, form_class: None = ...) -> BaseForm: ...
def get_form_class(self) -> Any: ...
def get_form_kwargs(self) -> Dict[str, Union[None, MultiValueDict]]: ...
def get_initial(self) -> Dict[Any, Any]: ...
def get_prefix(self) -> None: ...
def get_success_url(self) -> str: ...
class ModelFormMixin:
def get_form_class(self) -> Type[ModelForm]: ...
def get_form_kwargs(
self
) -> Dict[str, Union[None, MultiValueDict, Model]]: ...
def get_success_url(self) -> str: ...
class ProcessFormView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
def post(
self,
request: WSGIRequest,
*args,
**kwargs
) -> Union[TemplateResponse, HttpResponseRedirect]: ...

View File

@@ -0,0 +1,54 @@
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 typing import (
Any,
Dict,
List,
Optional,
Tuple,
Union,
)
class BaseListView:
def get(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
class MultipleObjectMixin:
def get_allow_empty(self) -> bool: ...
def get_context_data(self, *, object_list = ..., **kwargs) -> Dict[str, Any]: ...
def get_context_object_name(
self,
object_list: Optional[Union[QuerySet, List[Dict[str, str]]]]
) -> Optional[str]: ...
def get_ordering(self) -> None: ...
def get_paginate_by(self, queryset: Union[QuerySet, List[Dict[str, str]]]) -> Optional[int]: ...
def get_paginate_orphans(self) -> int: ...
def get_paginator(
self,
queryset: QuerySet,
per_page: int,
orphans: int = ...,
allow_empty_first_page: bool = ...,
**kwargs
) -> Paginator: ...
def get_queryset(self) -> Union[QuerySet, List[Dict[str, str]]]: ...
def paginate_queryset(
self,
queryset: QuerySet,
page_size: int
) -> Tuple[Paginator, Page, QuerySet, bool]: ...
class MultipleObjectTemplateResponseMixin:
def get_template_names(self) -> List[str]: ...