mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 14:01:56 +08:00
Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
194489ee8d | ||
|
|
1d2c7fb805 | ||
|
|
18c908bf98 | ||
|
|
e0e8814804 | ||
|
|
53f5d2214b | ||
|
|
9e4ed70fc5 | ||
|
|
18445f686f | ||
|
|
c962b8ac68 | ||
|
|
70c3126348 | ||
|
|
af8ecc5520 | ||
|
|
64f8870d0b | ||
|
|
df5c70c703 | ||
|
|
c09a97e005 | ||
|
|
0e30821ad3 | ||
|
|
2dadd681ff | ||
|
|
2dec3b4325 | ||
|
|
3b8c5d08e8 | ||
|
|
eaee3d390f | ||
|
|
b686751f19 | ||
|
|
73ea682356 | ||
|
|
9ea25f3e56 | ||
|
|
dacf88c692 | ||
|
|
3d14d07e4e | ||
|
|
6e6d1645d3 | ||
|
|
cda703a94b | ||
|
|
2bd018951b | ||
|
|
14ea848dd7 | ||
|
|
2d3b5492f0 | ||
|
|
194258ab8e | ||
|
|
116aa2c539 | ||
|
|
67c99434e5 | ||
|
|
5d8cdbcf29 | ||
|
|
78810f55b6 | ||
|
|
36662896bc | ||
|
|
e54dbb79c9 | ||
|
|
41f283552a | ||
|
|
ab73d53ae5 | ||
|
|
d24be4b35f | ||
|
|
9d60b472df | ||
|
|
632e063e22 | ||
|
|
66224416b5 | ||
|
|
e5b2496eb5 | ||
|
|
f980311be0 | ||
|
|
400a0f0486 | ||
|
|
882ec71d23 | ||
|
|
e9f9202ed1 | ||
|
|
6763217a80 | ||
|
|
6da5ead6f0 | ||
|
|
c382d6aa2f | ||
|
|
63a14f7107 | ||
|
|
dc33dd9493 | ||
|
|
4cb10390cf | ||
|
|
c1640b619f | ||
|
|
a08ad80a0d | ||
|
|
f30cd092f1 | ||
|
|
dcd9ee0bb8 | ||
|
|
26a80a8279 | ||
|
|
82de0a8791 | ||
|
|
79ebe20f2e | ||
|
|
587c2c484b | ||
|
|
4a22da29cb | ||
|
|
70378b8f40 | ||
|
|
b7f7713c5a | ||
|
|
2720b74242 | ||
|
|
563c0add5e | ||
|
|
3191740c6b |
22
.travis.yml
22
.travis.yml
@@ -4,20 +4,34 @@ dist: xenial
|
|||||||
sudo: required
|
sudo: required
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- name: Typecheck Django test suite
|
|
||||||
python: 3.7
|
|
||||||
script: 'python ./scripts/typecheck_tests.py'
|
|
||||||
|
|
||||||
- name: Run plugin test suite with python 3.7
|
- name: Run plugin test suite with python 3.7
|
||||||
python: 3.7
|
python: 3.7
|
||||||
script: |
|
script: |
|
||||||
set -e
|
set -e
|
||||||
pytest
|
pytest
|
||||||
|
|
||||||
|
- name: Run plugin test suite with python 3.6
|
||||||
|
python: 3.6
|
||||||
|
script: |
|
||||||
|
set -e
|
||||||
|
pytest
|
||||||
|
|
||||||
|
- name: Typecheck Django test suite
|
||||||
|
python: 3.7
|
||||||
|
script: 'python ./scripts/typecheck_tests.py'
|
||||||
|
|
||||||
- name: Lint with black
|
- name: Lint with black
|
||||||
python: 3.7
|
python: 3.7
|
||||||
script: 'black --check --line-length=120 django-stubs/'
|
script: 'black --check --line-length=120 django-stubs/'
|
||||||
|
|
||||||
|
- name: Lint plugin code with flake8
|
||||||
|
python: 3.7
|
||||||
|
script: 'flake8'
|
||||||
|
|
||||||
|
- name: Lint plugin code with isort
|
||||||
|
python: 3.7
|
||||||
|
script: 'isort --check'
|
||||||
|
|
||||||
before_install: |
|
before_install: |
|
||||||
# Upgrade pip, setuptools, and wheel
|
# Upgrade pip, setuptools, and wheel
|
||||||
pip install -U pip setuptools wheel
|
pip install -U pip setuptools wheel
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
This package contains type stubs and mypy plugin to provide more precise static types and type inference for Django framework. Django uses some Python "magic" that makes having precise types for some code patterns problematic. This is why we need to accompany the stubs with mypy plugins. The final goal is to be able to get precise types for most common patterns.
|
This package contains type stubs and mypy plugin to provide more precise static types and type inference for Django framework. Django uses some Python "magic" that makes having precise types for some code patterns problematic. This is why we need to accompany the stubs with mypy plugins. The final goal is to be able to get precise types for most common patterns.
|
||||||
|
|
||||||
|
Supports Python 3.6/3.7, and Django 2.1.x series.
|
||||||
|
|
||||||
|
Could be run on earlier versions of Django, but expect some missing imports warnings.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -26,7 +30,7 @@ in your `mypy.ini` file.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
In order to specify config file, set `MYPY_DJANGO_CONFIG` environment variable with path to the config file.
|
In order to specify config file, set `MYPY_DJANGO_CONFIG` environment variable with path to the config file. Default is `./mypy_django.ini`
|
||||||
|
|
||||||
Config file format (.ini):
|
Config file format (.ini):
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
black
|
black
|
||||||
-e git+https://github.com/mkurnikov/pytest-mypy-plugins.git#egg=pytest-mypy-plugins
|
pytest-mypy-plugins
|
||||||
|
flake8
|
||||||
|
isort==4.3.4
|
||||||
-e .
|
-e .
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class AppConfig:
|
|||||||
verbose_name: str = ...
|
verbose_name: str = ...
|
||||||
path: str = ...
|
path: str = ...
|
||||||
models_module: None = ...
|
models_module: None = ...
|
||||||
models: Optional[Dict[str, Type[Model]]] = ...
|
models: Dict[str, Type[Model]] = ...
|
||||||
def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ...
|
def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, entry: str) -> AppConfig: ...
|
def create(cls, entry: str) -> AppConfig: ...
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ by the DJANGO_SETTINGS_MODULE environment variable.
|
|||||||
|
|
||||||
# This is defined here as a do-nothing function because we can't import
|
# This is defined here as a do-nothing function because we can't import
|
||||||
# django.utils.translation -- that module depends on the settings.
|
# django.utils.translation -- that module depends on the settings.
|
||||||
from typing import Any, Dict, List, Optional, Pattern, Tuple, Protocol, Union, Callable, TYPE_CHECKING
|
from typing import Any, Dict, List, Optional, Pattern, Tuple, Protocol, Union, Callable, TYPE_CHECKING, Sequence
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# CORE #
|
# CORE #
|
||||||
@@ -377,7 +377,7 @@ CACHE_MIDDLEWARE_ALIAS = "default"
|
|||||||
|
|
||||||
AUTH_USER_MODEL: str = ...
|
AUTH_USER_MODEL: str = ...
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS: List[str] = ...
|
AUTHENTICATION_BACKENDS: Sequence[str] = ...
|
||||||
|
|
||||||
LOGIN_URL = "/accounts/login/"
|
LOGIN_URL = "/accounts/login/"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Iterator
|
||||||
|
|
||||||
from django.contrib.admin.options import ModelAdmin
|
from django.contrib.admin.options import ModelAdmin
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
@@ -16,7 +16,7 @@ class ListFilter:
|
|||||||
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
|
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def has_output(self) -> bool: ...
|
def has_output(self) -> bool: ...
|
||||||
def choices(self, changelist: Any) -> None: ...
|
def choices(self, changelist: Any) -> Optional[Iterator[Dict[str, Any]]]: ...
|
||||||
def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ...
|
def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ...
|
||||||
def expected_parameters(self) -> Optional[List[str]]: ...
|
def expected_parameters(self) -> Optional[List[str]]: ...
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class LogEntryManager(models.Manager["LogEntry"]):
|
|||||||
class LogEntry(models.Model):
|
class LogEntry(models.Model):
|
||||||
action_time: models.DateTimeField = ...
|
action_time: models.DateTimeField = ...
|
||||||
user: models.ForeignKey = ...
|
user: models.ForeignKey = ...
|
||||||
content_type: models.ForeignKey[ContentType] = ...
|
content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||||
object_id: models.TextField = ...
|
object_id: models.TextField = ...
|
||||||
object_repr: models.CharField = ...
|
object_repr: models.CharField = ...
|
||||||
action_flag: models.PositiveSmallIntegerField = ...
|
action_flag: models.PositiveSmallIntegerField = ...
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, Union, Iterator
|
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union
|
||||||
|
|
||||||
from django.contrib.admin.filters import ListFilter
|
from django.contrib.admin.filters import ListFilter
|
||||||
from django.contrib.admin.models import LogEntry
|
from django.contrib.admin.models import LogEntry
|
||||||
@@ -8,7 +8,6 @@ from django.contrib.admin.views.main import ChangeList
|
|||||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.checks.messages import Error
|
from django.core.checks.messages import Error
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField
|
from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField
|
||||||
@@ -17,12 +16,13 @@ from django.db.models.query import QuerySet
|
|||||||
from django.forms.fields import TypedChoiceField
|
from django.forms.fields import TypedChoiceField
|
||||||
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
||||||
from django.forms.widgets import Media
|
from django.forms.widgets import Media
|
||||||
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
|
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
|
||||||
|
from django.template.response import TemplateResponse
|
||||||
from django.urls.resolvers import URLPattern
|
from django.urls.resolvers import URLPattern
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
from django.template.response import TemplateResponse
|
|
||||||
|
|
||||||
IS_POPUP_VAR: str
|
IS_POPUP_VAR: str
|
||||||
TO_FIELD_VAR: str
|
TO_FIELD_VAR: str
|
||||||
@@ -57,40 +57,46 @@ class BaseModelAdmin:
|
|||||||
checks_class: Any = ...
|
checks_class: Any = ...
|
||||||
def check(self, **kwargs: Any) -> List[Union[str, Error]]: ...
|
def check(self, **kwargs: Any) -> List[Union[str, Error]]: ...
|
||||||
def __init__(self) -> None: ...
|
def __init__(self) -> None: ...
|
||||||
def formfield_for_dbfield(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> Optional[Field]: ...
|
def formfield_for_dbfield(
|
||||||
def formfield_for_choice_field(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> TypedChoiceField: ...
|
self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
|
||||||
def get_field_queryset(self, db: None, db_field: RelatedField, request: WSGIRequest) -> Optional[QuerySet]: ...
|
) -> Optional[Field]: ...
|
||||||
|
def formfield_for_choice_field(
|
||||||
|
self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
|
||||||
|
) -> TypedChoiceField: ...
|
||||||
|
def get_field_queryset(
|
||||||
|
self, db: None, db_field: RelatedField, request: Optional[HttpRequest]
|
||||||
|
) -> Optional[QuerySet]: ...
|
||||||
def formfield_for_foreignkey(
|
def formfield_for_foreignkey(
|
||||||
self, db_field: ForeignKey, request: WSGIRequest, **kwargs: Any
|
self, db_field: ForeignKey, request: Optional[HttpRequest], **kwargs: Any
|
||||||
) -> Optional[ModelChoiceField]: ...
|
) -> Optional[ModelChoiceField]: ...
|
||||||
def formfield_for_manytomany(
|
def formfield_for_manytomany(
|
||||||
self, db_field: ManyToManyField, request: WSGIRequest, **kwargs: Any
|
self, db_field: ManyToManyField, request: Optional[HttpRequest], **kwargs: Any
|
||||||
) -> ModelMultipleChoiceField: ...
|
) -> ModelMultipleChoiceField: ...
|
||||||
def get_autocomplete_fields(self, request: WSGIRequest) -> Tuple: ...
|
def get_autocomplete_fields(self, request: HttpRequest) -> Tuple: ...
|
||||||
def get_view_on_site_url(self, obj: Optional[Model] = ...) -> Optional[str]: ...
|
def get_view_on_site_url(self, obj: Optional[Model] = ...) -> Optional[str]: ...
|
||||||
def get_empty_value_display(self) -> SafeText: ...
|
def get_empty_value_display(self) -> SafeText: ...
|
||||||
def get_exclude(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Any: ...
|
def get_exclude(self, request: HttpRequest, obj: Optional[Model] = ...) -> Any: ...
|
||||||
def get_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Sequence[Union[Callable, str]]: ...
|
def get_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Sequence[Union[Callable, str]]: ...
|
||||||
def get_fieldsets(
|
def get_fieldsets(
|
||||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
self, request: HttpRequest, obj: Optional[Model] = ...
|
||||||
) -> List[Tuple[Optional[str], Dict[str, Any]]]: ...
|
) -> List[Tuple[Optional[str], Dict[str, Any]]]: ...
|
||||||
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
|
def get_ordering(self, request: HttpRequest) -> Union[List[str], Tuple]: ...
|
||||||
def get_readonly_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Union[List[str], Tuple]: ...
|
def get_readonly_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Union[List[str], Tuple]: ...
|
||||||
def get_prepopulated_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Dict[str, Tuple[str]]: ...
|
def get_prepopulated_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Dict[str, Tuple[str]]: ...
|
||||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
def get_queryset(self, request: HttpRequest) -> QuerySet: ...
|
||||||
def get_sortable_by(self, request: WSGIRequest) -> Union[List[Callable], List[str], Tuple]: ...
|
def get_sortable_by(self, request: HttpRequest) -> Union[List[Callable], List[str], Tuple]: ...
|
||||||
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
||||||
def to_field_allowed(self, request: WSGIRequest, to_field: str) -> bool: ...
|
def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
|
||||||
def has_add_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
def has_add_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||||
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
def has_change_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||||
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
def has_delete_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||||
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
def has_view_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||||
def has_module_permission(self, request: WSGIRequest) -> bool: ...
|
def has_module_permission(self, request: HttpRequest) -> bool: ...
|
||||||
|
|
||||||
class ModelAdmin(BaseModelAdmin):
|
class ModelAdmin(BaseModelAdmin):
|
||||||
formfield_overrides: Any
|
formfield_overrides: Any
|
||||||
list_display: Sequence[Union[str, Callable]] = ...
|
list_display: Sequence[Union[str, Callable]] = ...
|
||||||
list_display_links: Sequence[Union[str, Callable]] = ...
|
list_display_links: Optional[Sequence[Union[str, Callable]]] = ...
|
||||||
list_filter: Sequence[Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]]] = ...
|
list_filter: Sequence[Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]]] = ...
|
||||||
list_select_related: Union[bool, Sequence[str]] = ...
|
list_select_related: Union[bool, Sequence[str]] = ...
|
||||||
list_per_page: int = ...
|
list_per_page: int = ...
|
||||||
@@ -121,54 +127,54 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
opts: Options = ...
|
opts: Options = ...
|
||||||
admin_site: AdminSite = ...
|
admin_site: AdminSite = ...
|
||||||
def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ...
|
def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ...
|
||||||
def get_inline_instances(self, request: WSGIRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ...
|
def get_inline_instances(self, request: HttpRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ...
|
||||||
def get_urls(self) -> List[URLPattern]: ...
|
def get_urls(self) -> List[URLPattern]: ...
|
||||||
@property
|
@property
|
||||||
def urls(self) -> List[URLPattern]: ...
|
def urls(self) -> List[URLPattern]: ...
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
def get_model_perms(self, request: WSGIRequest) -> Dict[str, bool]: ...
|
def get_model_perms(self, request: HttpRequest) -> Dict[str, bool]: ...
|
||||||
def get_form(self, request: Any, obj: Optional[Any] = ..., change: bool = ..., **kwargs: Any): ...
|
def get_form(self, request: Any, obj: Optional[Any] = ..., change: bool = ..., **kwargs: Any): ...
|
||||||
def get_changelist(self, request: WSGIRequest, **kwargs: Any) -> Type[ChangeList]: ...
|
def get_changelist(self, request: HttpRequest, **kwargs: Any) -> Type[ChangeList]: ...
|
||||||
def get_changelist_instance(self, request: WSGIRequest) -> ChangeList: ...
|
def get_changelist_instance(self, request: HttpRequest) -> ChangeList: ...
|
||||||
def get_object(self, request: WSGIRequest, object_id: str, from_field: None = ...) -> Optional[Model]: ...
|
def get_object(self, request: HttpRequest, object_id: str, from_field: None = ...) -> Optional[Model]: ...
|
||||||
def get_changelist_form(self, request: Any, **kwargs: Any): ...
|
def get_changelist_form(self, request: Any, **kwargs: Any): ...
|
||||||
def get_changelist_formset(self, request: Any, **kwargs: Any): ...
|
def get_changelist_formset(self, request: Any, **kwargs: Any): ...
|
||||||
def get_formsets_with_inlines(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Iterator[Any]: ...
|
def get_formsets_with_inlines(self, request: HttpRequest, obj: Optional[Model] = ...) -> Iterator[Any]: ...
|
||||||
def get_paginator(
|
def get_paginator(
|
||||||
self,
|
self,
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
queryset: QuerySet,
|
queryset: QuerySet,
|
||||||
per_page: int,
|
per_page: int,
|
||||||
orphans: int = ...,
|
orphans: int = ...,
|
||||||
allow_empty_first_page: bool = ...,
|
allow_empty_first_page: bool = ...,
|
||||||
) -> Paginator: ...
|
) -> Paginator: ...
|
||||||
def log_addition(self, request: WSGIRequest, object: Model, message: Any) -> LogEntry: ...
|
def log_addition(self, request: HttpRequest, object: Model, message: Any) -> LogEntry: ...
|
||||||
def log_change(self, request: WSGIRequest, object: Model, message: Any) -> LogEntry: ...
|
def log_change(self, request: HttpRequest, object: Model, message: Any) -> LogEntry: ...
|
||||||
def log_deletion(self, request: WSGIRequest, object: Model, object_repr: str) -> LogEntry: ...
|
def log_deletion(self, request: HttpRequest, object: Model, object_repr: str) -> LogEntry: ...
|
||||||
def action_checkbox(self, obj: Model) -> SafeText: ...
|
def action_checkbox(self, obj: Model) -> SafeText: ...
|
||||||
def get_actions(self, request: WSGIRequest) -> OrderedDict: ...
|
def get_actions(self, request: HttpRequest) -> OrderedDict: ...
|
||||||
def get_action_choices(
|
def get_action_choices(
|
||||||
self, request: WSGIRequest, default_choices: List[Tuple[str, str]] = ...
|
self, request: HttpRequest, default_choices: List[Tuple[str, str]] = ...
|
||||||
) -> List[Tuple[str, str]]: ...
|
) -> List[Tuple[str, str]]: ...
|
||||||
def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ...
|
def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ...
|
||||||
def get_list_display(self, request: WSGIRequest) -> Sequence[str]: ...
|
def get_list_display(self, request: HttpRequest) -> Sequence[str]: ...
|
||||||
def get_list_display_links(self, request: WSGIRequest, list_display: Sequence[str]) -> Optional[Sequence[str]]: ...
|
def get_list_display_links(self, request: HttpRequest, list_display: Sequence[str]) -> Optional[Sequence[str]]: ...
|
||||||
def get_list_filter(self, request: WSGIRequest) -> Sequence[str]: ...
|
def get_list_filter(self, request: HttpRequest) -> Sequence[str]: ...
|
||||||
def get_list_select_related(self, request: WSGIRequest) -> Sequence[str]: ...
|
def get_list_select_related(self, request: HttpRequest) -> Sequence[str]: ...
|
||||||
def get_search_fields(self, request: WSGIRequest) -> List[str]: ...
|
def get_search_fields(self, request: HttpRequest) -> List[str]: ...
|
||||||
def get_search_results(
|
def get_search_results(
|
||||||
self, request: WSGIRequest, queryset: QuerySet, search_term: str
|
self, request: HttpRequest, queryset: QuerySet, search_term: str
|
||||||
) -> Tuple[QuerySet, bool]: ...
|
) -> Tuple[QuerySet, bool]: ...
|
||||||
def get_preserved_filters(self, request: WSGIRequest) -> str: ...
|
def get_preserved_filters(self, request: HttpRequest) -> str: ...
|
||||||
def _get_edited_object_pks(self, request: WSGIRequest, prefix: str) -> List[str]: ...
|
def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> List[str]: ...
|
||||||
def _get_list_editable_queryset(self, request: WSGIRequest, prefix: str) -> QuerySet: ...
|
def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet: ...
|
||||||
def construct_change_message(
|
def construct_change_message(
|
||||||
self, request: WSGIRequest, form: AdminPasswordChangeForm, formsets: None, add: bool = ...
|
self, request: HttpRequest, form: AdminPasswordChangeForm, formsets: None, add: bool = ...
|
||||||
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
||||||
def message_user(
|
def message_user(
|
||||||
self,
|
self,
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
message: str,
|
message: str,
|
||||||
level: Union[int, str] = ...,
|
level: Union[int, str] = ...,
|
||||||
extra_tags: str = ...,
|
extra_tags: str = ...,
|
||||||
@@ -176,8 +182,8 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
) -> None: ...
|
) -> None: ...
|
||||||
def save_form(self, request: Any, form: Any, change: Any): ...
|
def save_form(self, request: Any, form: Any, change: Any): ...
|
||||||
def save_model(self, request: Any, obj: Any, form: Any, change: Any) -> None: ...
|
def save_model(self, request: Any, obj: Any, form: Any, change: Any) -> None: ...
|
||||||
def delete_model(self, request: WSGIRequest, obj: Model) -> None: ...
|
def delete_model(self, request: HttpRequest, obj: Model) -> None: ...
|
||||||
def delete_queryset(self, request: WSGIRequest, queryset: QuerySet) -> None: ...
|
def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ...
|
||||||
def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: ...
|
def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: ...
|
||||||
def save_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ...
|
def save_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ...
|
||||||
def render_change_form(
|
def render_change_form(
|
||||||
@@ -190,52 +196,51 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
obj: Optional[Any] = ...,
|
obj: Optional[Any] = ...,
|
||||||
): ...
|
): ...
|
||||||
def response_add(
|
def response_add(
|
||||||
self, request: WSGIRequest, obj: Model, post_url_continue: Optional[str] = ...
|
self, request: HttpRequest, obj: Model, post_url_continue: Optional[str] = ...
|
||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
def response_change(self, request: WSGIRequest, obj: Model) -> HttpResponse: ...
|
def response_change(self, request: HttpRequest, obj: Model) -> HttpResponse: ...
|
||||||
def response_post_save_add(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ...
|
def response_post_save_add(self, request: HttpRequest, obj: Model) -> HttpResponseRedirect: ...
|
||||||
def response_post_save_change(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ...
|
def response_post_save_change(self, request: HttpRequest, obj: Model) -> HttpResponseRedirect: ...
|
||||||
def response_action(self, request: WSGIRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ...
|
def response_action(self, request: HttpRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ...
|
||||||
def response_delete(self, request: WSGIRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
|
def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
|
||||||
def render_delete_form(self, request: Any, context: Any): ...
|
def render_delete_form(self, request: Any, context: Any): ...
|
||||||
def get_inline_formsets(
|
def get_inline_formsets(
|
||||||
self, request: WSGIRequest, formsets: List[Any], inline_instances: List[Any], obj: Optional[Model] = ...
|
self, request: HttpRequest, formsets: List[Any], inline_instances: List[Any], obj: Optional[Model] = ...
|
||||||
) -> List[Any]: ...
|
) -> List[Any]: ...
|
||||||
def get_changeform_initial_data(self, request: WSGIRequest) -> Dict[str, str]: ...
|
def get_changeform_initial_data(self, request: HttpRequest) -> Dict[str, str]: ...
|
||||||
def changeform_view(
|
def changeform_view(
|
||||||
self,
|
self,
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
object_id: Optional[str] = ...,
|
object_id: Optional[str] = ...,
|
||||||
form_url: str = ...,
|
form_url: str = ...,
|
||||||
extra_context: Optional[Dict[str, bool]] = ...,
|
extra_context: Optional[Dict[str, bool]] = ...,
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
def autocomplete_view(self, request: WSGIRequest) -> JsonResponse: ...
|
def autocomplete_view(self, request: HttpRequest) -> JsonResponse: ...
|
||||||
def add_view(self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
|
def add_view(self, request: HttpRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
|
||||||
def change_view(
|
def change_view(
|
||||||
self, request: WSGIRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ...
|
self, request: HttpRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ...
|
||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
def changelist_view(
|
def changelist_view(
|
||||||
self, request: WSGIRequest, extra_context: Optional[Dict[str, str]] = ...
|
self, request: HttpRequest, extra_context: Optional[Dict[str, str]] = ...
|
||||||
) -> TemplateResponse: ...
|
) -> TemplateResponse: ...
|
||||||
def get_deleted_objects(
|
def get_deleted_objects(
|
||||||
self, objs: QuerySet, request: WSGIRequest
|
self, objs: QuerySet, request: HttpRequest
|
||||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||||
def delete_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> Any: ...
|
def delete_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> Any: ...
|
||||||
def history_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...
|
def history_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...
|
||||||
|
|
||||||
class InlineModelAdmin(BaseModelAdmin):
|
class InlineModelAdmin(BaseModelAdmin):
|
||||||
model: Any = ...
|
model: Any = ...
|
||||||
fk_name: Any = ...
|
fk_name: Any = ...
|
||||||
formset: Any = ...
|
formset: Any = ...
|
||||||
extra: int = ...
|
extra: int = ...
|
||||||
min_num: Any = ...
|
min_num: Optional[int] = ...
|
||||||
max_num: Any = ...
|
max_num: Optional[int] = ...
|
||||||
template: Any = ...
|
template: str = ...
|
||||||
verbose_name: Any = ...
|
verbose_name: Optional[str] = ...
|
||||||
verbose_name_plural: Any = ...
|
verbose_name_plural: Optional[str] = ...
|
||||||
can_delete: bool = ...
|
can_delete: bool = ...
|
||||||
show_change_link: bool = ...
|
show_change_link: bool = ...
|
||||||
checks_class: Any = ...
|
|
||||||
classes: Any = ...
|
classes: Any = ...
|
||||||
admin_site: Any = ...
|
admin_site: Any = ...
|
||||||
parent_model: Any = ...
|
parent_model: Any = ...
|
||||||
@@ -244,18 +249,10 @@ class InlineModelAdmin(BaseModelAdmin):
|
|||||||
def __init__(self, parent_model: Union[Type[Model], Model], admin_site: AdminSite) -> None: ...
|
def __init__(self, parent_model: Union[Type[Model], Model], admin_site: AdminSite) -> None: ...
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
def get_extra(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> int: ...
|
def get_extra(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> int: ...
|
||||||
def get_min_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> None: ...
|
def get_min_num(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||||
def get_max_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
|
def get_max_num(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||||
fields: Any = ...
|
|
||||||
def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
|
def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
|
||||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
|
||||||
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
|
||||||
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
|
||||||
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
|
||||||
|
|
||||||
class StackedInline(InlineModelAdmin):
|
class StackedInline(InlineModelAdmin): ...
|
||||||
template: str = ...
|
class TabularInline(InlineModelAdmin): ...
|
||||||
|
|
||||||
class TabularInline(InlineModelAdmin):
|
|
||||||
template: str = ...
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class NestedObjects(Collector):
|
|||||||
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
|
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
|
||||||
def collect(
|
def collect(
|
||||||
self,
|
self,
|
||||||
objs: Union[Sequence[Model], QuerySet],
|
objs: Union[Sequence[Optional[Model]], QuerySet],
|
||||||
source: Optional[Type[Model]] = ...,
|
source: Optional[Type[Model]] = ...,
|
||||||
source_attr: Optional[str] = ...,
|
source_attr: Optional[str] = ...,
|
||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import User, Group
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
|
from django.db.models.fields import Field
|
||||||
from django.db.models.fields.related import ManyToManyField
|
from django.db.models.fields.related import ManyToManyField
|
||||||
|
from django.db.models.options import Options
|
||||||
from django.forms.models import ModelMultipleChoiceField
|
from django.forms.models import ModelMultipleChoiceField
|
||||||
|
from django.forms.fields import Field as FormField
|
||||||
|
from django.forms.widgets import Widget
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
from django.urls.resolvers import URLPattern
|
from django.urls.resolvers import URLPattern
|
||||||
|
|
||||||
@@ -27,10 +31,7 @@ class GroupAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
class UserAdmin(admin.ModelAdmin):
|
class UserAdmin(admin.ModelAdmin):
|
||||||
admin_site: AdminSite
|
admin_site: AdminSite
|
||||||
formfield_overrides: Dict[
|
formfield_overrides: Dict[Type[Field], Dict[str, Type[Union[FormField, Widget]]]]
|
||||||
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
|
|
||||||
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, Widget]]],
|
|
||||||
]
|
|
||||||
model: Type[User]
|
model: Type[User]
|
||||||
opts: Options
|
opts: Options
|
||||||
add_form_template: str = ...
|
add_form_template: str = ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Optional, Tuple, List
|
from typing import Any, Optional, Tuple, List, overload
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
@@ -30,4 +30,8 @@ class AbstractBaseUser(models.Model):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_email_field_name(cls) -> str: ...
|
def get_email_field_name(cls) -> str: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@overload
|
||||||
def normalize_username(cls, username: str) -> str: ...
|
def normalize_username(cls, username: str) -> str: ...
|
||||||
|
@classmethod
|
||||||
|
@overload
|
||||||
|
def normalize_username(cls, username: Any) -> Any: ...
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class UserCreationForm(forms.ModelForm):
|
|||||||
password2: Any = ...
|
password2: Any = ...
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def clean_password2(self) -> str: ...
|
def clean_password2(self) -> str: ...
|
||||||
def save(self, commit: bool = ...) -> User: ...
|
|
||||||
|
|
||||||
class UserChangeForm(forms.ModelForm):
|
class UserChangeForm(forms.ModelForm):
|
||||||
auto_id: str
|
auto_id: str
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import Any, Callable, List, Optional
|
from typing import Any, Callable, List, Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django import http
|
||||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||||
|
|
||||||
class AccessMixin:
|
class AccessMixin:
|
||||||
@@ -14,15 +14,15 @@ class AccessMixin:
|
|||||||
def handle_no_permission(self) -> HttpResponseRedirect: ...
|
def handle_no_permission(self) -> HttpResponseRedirect: ...
|
||||||
|
|
||||||
class LoginRequiredMixin(AccessMixin):
|
class LoginRequiredMixin(AccessMixin):
|
||||||
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
|
|
||||||
class PermissionRequiredMixin(AccessMixin):
|
class PermissionRequiredMixin(AccessMixin):
|
||||||
permission_required: Any = ...
|
permission_required: Any = ...
|
||||||
def get_permission_required(self) -> List[str]: ...
|
def get_permission_required(self) -> List[str]: ...
|
||||||
def has_permission(self) -> bool: ...
|
def has_permission(self) -> bool: ...
|
||||||
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
|
|
||||||
class UserPassesTestMixin(AccessMixin):
|
class UserPassesTestMixin(AccessMixin):
|
||||||
def test_func(self) -> None: ...
|
def test_func(self) -> None: ...
|
||||||
def get_test_func(self) -> Callable: ...
|
def get_test_func(self) -> Callable: ...
|
||||||
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PermissionManager(models.Manager):
|
|||||||
class Permission(models.Model):
|
class Permission(models.Model):
|
||||||
content_type_id: int
|
content_type_id: int
|
||||||
name: models.CharField = ...
|
name: models.CharField = ...
|
||||||
content_type: models.ForeignKey[ContentType] = ...
|
content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||||
codename: models.CharField = ...
|
codename: models.CharField = ...
|
||||||
def natural_key(self) -> Tuple[str, str, str]: ...
|
def natural_key(self) -> Tuple[str, str, str]: ...
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class GroupManager(models.Manager):
|
|||||||
|
|
||||||
class Group(models.Model):
|
class Group(models.Model):
|
||||||
name: models.CharField = ...
|
name: models.CharField = ...
|
||||||
permissions: models.ManyToManyField[Permission] = ...
|
permissions: models.ManyToManyField = models.ManyToManyField(Permission)
|
||||||
def natural_key(self): ...
|
def natural_key(self): ...
|
||||||
|
|
||||||
class UserManager(BaseUserManager):
|
class UserManager(BaseUserManager):
|
||||||
@@ -37,8 +37,8 @@ class UserManager(BaseUserManager):
|
|||||||
|
|
||||||
class PermissionsMixin(models.Model):
|
class PermissionsMixin(models.Model):
|
||||||
is_superuser: models.BooleanField = ...
|
is_superuser: models.BooleanField = ...
|
||||||
groups: models.ManyToManyField[Group] = ...
|
groups: models.ManyToManyField = models.ManyToManyField(Group)
|
||||||
user_permissions: models.ManyToManyField[Permission] = ...
|
user_permissions: models.ManyToManyField = models.ManyToManyField(Permission)
|
||||||
def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
|
def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
|
||||||
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
|
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
|
||||||
def has_perm(self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...) -> bool: ...
|
def has_perm(self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...) -> bool: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, Generic
|
||||||
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.checks.messages import Error
|
from django.core.checks.messages import Error
|
||||||
|
|||||||
@@ -4,12 +4,7 @@ from django.db import models
|
|||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
class ContentTypeManager(models.Manager):
|
class ContentTypeManager(models.Manager["ContentType"]):
|
||||||
creation_counter: int
|
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
use_in_migrations: bool = ...
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
||||||
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
|
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
|
||||||
def get_for_model(self, model: Union[Type[Model], Model], for_concrete_model: bool = ...) -> ContentType: ...
|
def get_for_model(self, model: Union[Type[Model], Model], for_concrete_model: bool = ...) -> ContentType: ...
|
||||||
def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ...
|
def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ...
|
||||||
@@ -18,9 +13,9 @@ class ContentTypeManager(models.Manager):
|
|||||||
|
|
||||||
class ContentType(models.Model):
|
class ContentType(models.Model):
|
||||||
id: int
|
id: int
|
||||||
app_label: str = ...
|
app_label: models.CharField = ...
|
||||||
model: str = ...
|
model: models.CharField = ...
|
||||||
objects: Any = ...
|
objects: ContentTypeManager = ...
|
||||||
@property
|
@property
|
||||||
def name(self) -> str: ...
|
def name(self) -> str: ...
|
||||||
def model_class(self) -> Optional[Type[Model]]: ...
|
def model_class(self) -> Optional[Type[Model]]: ...
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
from typing import Any, Optional
|
from django.contrib.sites.models import Site
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class FlatPage(models.Model):
|
class FlatPage(models.Model):
|
||||||
id: None
|
url: models.CharField = ...
|
||||||
url: str = ...
|
title: models.CharField = ...
|
||||||
title: str = ...
|
content: models.TextField = ...
|
||||||
content: str = ...
|
enable_comments: models.BooleanField = ...
|
||||||
enable_comments: bool = ...
|
template_name: models.CharField = ...
|
||||||
template_name: str = ...
|
registration_required: models.BooleanField = ...
|
||||||
registration_required: bool = ...
|
sites: models.ManyToManyField[Site] = ...
|
||||||
sites: Any = ...
|
|
||||||
def get_absolute_url(self) -> str: ...
|
def get_absolute_url(self) -> str: ...
|
||||||
|
|||||||
@@ -1,20 +1,51 @@
|
|||||||
from typing import Any, Generic, List, Optional, Sequence, TypeVar
|
from typing import Any, Iterable, List, Optional, Sequence, TypeVar, Union
|
||||||
|
|
||||||
|
from django.db.models.expressions import Combinable
|
||||||
|
from django.db.models.fields import Field, _ErrorMessagesToOverride, _FieldChoices, _ValidatorCallable
|
||||||
|
|
||||||
from django.db.models.fields import Field
|
|
||||||
from .mixins import CheckFieldDefaultMixin
|
from .mixins import CheckFieldDefaultMixin
|
||||||
|
|
||||||
_T = TypeVar("_T", bound=Field)
|
# __set__ value type
|
||||||
|
_ST = TypeVar("_ST")
|
||||||
|
# __get__ return type
|
||||||
|
_GT = TypeVar("_GT")
|
||||||
|
|
||||||
|
class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Union[Sequence[Any], Combinable]
|
||||||
|
_pyi_private_get_type: List[Any]
|
||||||
|
|
||||||
class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
|
||||||
empty_strings_allowed: bool = ...
|
empty_strings_allowed: bool = ...
|
||||||
default_error_messages: Any = ...
|
default_error_messages: Any = ...
|
||||||
base_field: Any = ...
|
base_field: Any = ...
|
||||||
size: Any = ...
|
size: Any = ...
|
||||||
default_validators: Any = ...
|
default_validators: Any = ...
|
||||||
from_db_value: Any = ...
|
from_db_value: Any = ...
|
||||||
def __init__(self, base_field: _T, size: Optional[int] = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
base_field: Field,
|
||||||
|
size: Optional[int] = ...,
|
||||||
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
primary_key: bool = ...,
|
||||||
|
max_length: Optional[int] = ...,
|
||||||
|
unique: bool = ...,
|
||||||
|
blank: bool = ...,
|
||||||
|
null: bool = ...,
|
||||||
|
db_index: bool = ...,
|
||||||
|
default: Any = ...,
|
||||||
|
editable: bool = ...,
|
||||||
|
auto_created: bool = ...,
|
||||||
|
serialize: bool = ...,
|
||||||
|
unique_for_date: Optional[str] = ...,
|
||||||
|
unique_for_month: Optional[str] = ...,
|
||||||
|
unique_for_year: Optional[str] = ...,
|
||||||
|
choices: Optional[_FieldChoices] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
db_column: Optional[str] = ...,
|
||||||
|
db_tablespace: Optional[str] = ...,
|
||||||
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
|
) -> None: ...
|
||||||
@property
|
@property
|
||||||
def description(self): ...
|
def description(self): ...
|
||||||
def get_transform(self, name: Any): ...
|
def get_transform(self, name: Any): ...
|
||||||
def __set__(self, instance, value: Sequence[_T]) -> None: ...
|
|
||||||
def __get__(self, instance, owner) -> List[_T]: ...
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
class RedirectFallbackMiddleware(MiddlewareMixin):
|
class RedirectFallbackMiddleware(MiddlewareMixin):
|
||||||
response_gone_class: Any = ...
|
response_gone_class: Any = ...
|
||||||
response_redirect_class: Any = ...
|
response_redirect_class: Any = ...
|
||||||
def process_response(self, request: WSGIRequest, response: HttpResponse) -> HttpResponse: ...
|
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional, Type
|
||||||
|
|
||||||
|
from django.contrib.sessions.backends.base import SessionBase
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class BaseSessionManager(models.Manager):
|
class BaseSessionManager(models.Manager):
|
||||||
creation_counter: int
|
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
def encode(self, session_dict: Dict[str, int]) -> str: ...
|
def encode(self, session_dict: Dict[str, int]) -> str: ...
|
||||||
def save(self, session_key: str, session_dict: Dict[str, int], expire_date: datetime) -> AbstractBaseSession: ...
|
def save(self, session_key: str, session_dict: Dict[str, int], expire_date: datetime) -> AbstractBaseSession: ...
|
||||||
|
|
||||||
class AbstractBaseSession(models.Model):
|
class AbstractBaseSession(models.Model):
|
||||||
session_key: Any = ...
|
expire_date: datetime
|
||||||
session_data: Any = ...
|
session_data: str
|
||||||
expire_date: Any = ...
|
session_key: str
|
||||||
objects: Any = ...
|
objects: Any = ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_session_store_class(cls) -> None: ...
|
def get_session_store_class(cls) -> Optional[Type[SessionBase]]: ...
|
||||||
def get_decoded(self) -> Dict[str, int]: ...
|
def get_decoded(self) -> Dict[str, int]: ...
|
||||||
|
|||||||
@@ -1,18 +1,4 @@
|
|||||||
from typing import Any, Optional, Type
|
|
||||||
|
|
||||||
from django.contrib.sessions.backends.db import SessionStore
|
|
||||||
from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager
|
from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager
|
||||||
|
|
||||||
class SessionManager(BaseSessionManager):
|
class SessionManager(BaseSessionManager): ...
|
||||||
creation_counter: int
|
class Session(AbstractBaseSession): ...
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
use_in_migrations: bool = ...
|
|
||||||
|
|
||||||
class Session(AbstractBaseSession):
|
|
||||||
expire_date: datetime.datetime
|
|
||||||
session_data: str
|
|
||||||
session_key: str
|
|
||||||
objects: Any = ...
|
|
||||||
@classmethod
|
|
||||||
def get_session_store_class(cls) -> Type[SessionStore]: ...
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, Optional
|
from typing import Dict
|
||||||
|
|
||||||
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ PING_URL: str
|
|||||||
|
|
||||||
class SitemapNotFound(Exception): ...
|
class SitemapNotFound(Exception): ...
|
||||||
|
|
||||||
def ping_google(sitemap_url: None = ..., ping_url: str = ...) -> None: ...
|
def ping_google(sitemap_url: Optional[str] = ..., ping_url: str = ...) -> None: ...
|
||||||
|
|
||||||
class Sitemap:
|
class Sitemap:
|
||||||
limit: int = ...
|
limit: int = ...
|
||||||
@@ -22,14 +22,14 @@ class Sitemap:
|
|||||||
def paginator(self) -> Paginator: ...
|
def paginator(self) -> Paginator: ...
|
||||||
def get_urls(
|
def get_urls(
|
||||||
self, page: Union[int, str] = ..., site: Optional[Union[Site, RequestSite]] = ..., protocol: Optional[str] = ...
|
self, page: Union[int, str] = ..., site: Optional[Union[Site, RequestSite]] = ..., protocol: Optional[str] = ...
|
||||||
) -> List[Dict[str, Optional[Union[datetime, Model, str]]]]: ...
|
) -> List[Dict[str, Any]]: ...
|
||||||
|
|
||||||
class GenericSitemap(Sitemap):
|
class GenericSitemap(Sitemap):
|
||||||
priority: None = ...
|
priority: Optional[float] = ...
|
||||||
changefreq: None = ...
|
changefreq: Optional[str] = ...
|
||||||
queryset: QuerySet = ...
|
queryset: QuerySet = ...
|
||||||
date_field: None = ...
|
date_field: None = ...
|
||||||
protocol: None = ...
|
protocol: Optional[str] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
info_dict: Dict[str, Union[datetime, QuerySet, str]],
|
info_dict: Dict[str, Union[datetime, QuerySet, str]],
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Any, Callable, Dict, Optional, Type, Union
|
from typing import Callable, Dict, Optional, Type, Union
|
||||||
|
|
||||||
|
from django.http.request import HttpRequest
|
||||||
|
from django.template.response import TemplateResponse
|
||||||
|
|
||||||
from django.contrib.sitemaps import GenericSitemap, Sitemap
|
from django.contrib.sitemaps import GenericSitemap, Sitemap
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
|
||||||
from django.template.response import TemplateResponse
|
|
||||||
|
|
||||||
def x_robots_tag(func: Callable) -> Callable: ...
|
def x_robots_tag(func: Callable) -> Callable: ...
|
||||||
def index(
|
def index(
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]],
|
sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]],
|
||||||
template_name: str = ...,
|
template_name: str = ...,
|
||||||
content_type: str = ...,
|
content_type: str = ...,
|
||||||
sitemap_url_name: str = ...,
|
sitemap_url_name: str = ...,
|
||||||
) -> TemplateResponse: ...
|
) -> TemplateResponse: ...
|
||||||
def sitemap(
|
def sitemap(
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict],
|
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict],
|
||||||
section: Optional[str] = ...,
|
section: Optional[str] = ...,
|
||||||
template_name: str = ...,
|
template_name: str = ...,
|
||||||
|
|||||||
2
django-stubs/core/cache/__init__.pyi
vendored
2
django-stubs/core/cache/__init__.pyi
vendored
@@ -1,7 +1,7 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Any, Callable, Dict, Union
|
from typing import Any, Callable, Dict, Union
|
||||||
|
|
||||||
from django.core.cache.backends.base import BaseCache as BaseCache
|
from .backends.base import BaseCache as BaseCache
|
||||||
|
|
||||||
DEFAULT_CACHE_ALIAS: str
|
DEFAULT_CACHE_ALIAS: str
|
||||||
|
|
||||||
|
|||||||
4
django-stubs/core/cache/utils.pyi
vendored
4
django-stubs/core/cache/utils.pyi
vendored
@@ -1,5 +1,5 @@
|
|||||||
from typing import Any, List, Optional, Union
|
from typing import Any, Iterable, Optional
|
||||||
|
|
||||||
TEMPLATE_FRAGMENT_KEY_TEMPLATE: str
|
TEMPLATE_FRAGMENT_KEY_TEMPLATE: str
|
||||||
|
|
||||||
def make_template_fragment_key(fragment_name: str, vary_on: Optional[Union[List[int], List[str]]] = ...) -> str: ...
|
def make_template_fragment_key(fragment_name: str, vary_on: Optional[Iterable[Any]] = ...) -> str: ...
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
from typing import Any, Dict, Iterator, List, Mapping, Optional, Tuple, Union
|
||||||
|
|
||||||
from django.db.models.base import Model
|
|
||||||
from django.forms.utils import ErrorDict
|
from django.forms.utils import ErrorDict
|
||||||
|
|
||||||
class FieldDoesNotExist(Exception): ...
|
class FieldDoesNotExist(Exception): ...
|
||||||
@@ -31,20 +30,13 @@ class ValidationError(Exception):
|
|||||||
message: Any = ...
|
message: Any = ...
|
||||||
code: Any = ...
|
code: Any = ...
|
||||||
params: Any = ...
|
params: Any = ...
|
||||||
def __init__(
|
def __init__(self, message: Any, code: Optional[str] = ..., params: Optional[Mapping[str, Any]] = ...) -> None: ...
|
||||||
self,
|
|
||||||
message: Any,
|
|
||||||
code: Optional[str] = ...,
|
|
||||||
params: Optional[
|
|
||||||
Union[Dict[str, Union[Tuple[str], Type[Model], Model, str]], Dict[str, Union[int, str]]]
|
|
||||||
] = ...,
|
|
||||||
) -> None: ...
|
|
||||||
@property
|
@property
|
||||||
def message_dict(self) -> Dict[str, List[str]]: ...
|
def message_dict(self) -> Dict[str, List[str]]: ...
|
||||||
@property
|
@property
|
||||||
def messages(self) -> List[str]: ...
|
def messages(self) -> List[str]: ...
|
||||||
def update_error_dict(
|
def update_error_dict(
|
||||||
self, error_dict: Union[Dict[str, List[ValidationError]], ErrorDict]
|
self, error_dict: Mapping[str, Any]
|
||||||
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
|
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
|
||||||
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...
|
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import StringIO, TextIOWrapper
|
from typing import Any, IO, List, Optional, Tuple
|
||||||
from typing import Any, List, Optional, Tuple, Union
|
|
||||||
|
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
from django.utils.functional import LazyObject
|
from django.utils.functional import LazyObject
|
||||||
|
|
||||||
class Storage:
|
class Storage:
|
||||||
def open(self, name: str, mode: str = ...) -> File: ...
|
def open(self, name: str, mode: str = ...) -> File: ...
|
||||||
def save(
|
def save(self, name: Optional[str], content: IO[Any], max_length: Optional[int] = ...) -> str: ...
|
||||||
self, name: Optional[str], content: Union[StringIO, TextIOWrapper, File], max_length: Optional[int] = ...
|
|
||||||
) -> str: ...
|
|
||||||
def get_valid_name(self, name: str) -> str: ...
|
def get_valid_name(self, name: str) -> str: ...
|
||||||
def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
|
def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
|
||||||
def generate_filename(self, filename: str) -> str: ...
|
def generate_filename(self, filename: str) -> str: ...
|
||||||
|
|||||||
@@ -1,45 +1,48 @@
|
|||||||
# Stubs for django.core.files.uploadedfile (Python 3.5)
|
|
||||||
|
|
||||||
from typing import Any, Dict, IO, Iterator, Optional, Union
|
from typing import Any, Dict, IO, Iterator, Optional, Union
|
||||||
from django.core.files import temp as tempfile
|
from django.core.files import temp as tempfile
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
|
|
||||||
class UploadedFile(File):
|
class UploadedFile(File):
|
||||||
content_type = ... # type: Optional[str]
|
content_type: Optional[str] = ...
|
||||||
charset = ... # type: Optional[str]
|
charset: Optional[str] = ...
|
||||||
content_type_extra = ... # type: Optional[Dict[str, str]]
|
content_type_extra: Optional[Dict[str, str]] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
file: IO,
|
file: Optional[IO] = ...,
|
||||||
name: str = None,
|
name: Optional[str] = ...,
|
||||||
content_type: str = None,
|
content_type: Optional[str] = ...,
|
||||||
size: int = None,
|
size: Optional[int] = ...,
|
||||||
charset: str = None,
|
charset: Optional[str] = ...,
|
||||||
content_type_extra: Dict[str, str] = None,
|
content_type_extra: Optional[Dict[str, str]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
class TemporaryUploadedFile(UploadedFile):
|
class TemporaryUploadedFile(UploadedFile):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, name: str, content_type: str, size: int, charset: str, content_type_extra: Dict[str, str] = None
|
self,
|
||||||
|
name: Optional[str],
|
||||||
|
content_type: Optional[str],
|
||||||
|
size: Optional[int],
|
||||||
|
charset: Optional[str],
|
||||||
|
content_type_extra: Optional[Dict[str, str]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def temporary_file_path(self) -> str: ...
|
def temporary_file_path(self) -> str: ...
|
||||||
|
|
||||||
class InMemoryUploadedFile(UploadedFile):
|
class InMemoryUploadedFile(UploadedFile):
|
||||||
field_name = ... # type: Optional[str]
|
field_name: Optional[str] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
file: IO,
|
file: IO,
|
||||||
field_name: Optional[str],
|
field_name: Optional[str],
|
||||||
name: str,
|
name: Optional[str],
|
||||||
content_type: Optional[str],
|
content_type: Optional[str],
|
||||||
size: int,
|
size: Optional[int],
|
||||||
charset: Optional[str],
|
charset: Optional[str],
|
||||||
content_type_extra: Dict[str, str] = None,
|
content_type_extra: Dict[str, str] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def chunks(self, chunk_size: int = None) -> Iterator[bytes]: ...
|
def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ...
|
||||||
def multiple_chunks(self, chunk_size: int = None) -> bool: ...
|
def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ...
|
||||||
|
|
||||||
class SimpleUploadedFile(InMemoryUploadedFile):
|
class SimpleUploadedFile(InMemoryUploadedFile):
|
||||||
def __init__(self, name: str, content: bytes, content_type: str = "") -> None: ...
|
def __init__(self, name: str, content: Optional[Union[bytes, str]], content_type: str = ...) -> None: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ...
|
def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ...
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseBase
|
from django.http.response import HttpResponse, HttpResponseBase
|
||||||
|
|
||||||
logger: Any
|
logger: Any
|
||||||
@@ -13,5 +13,5 @@ class BaseHandler:
|
|||||||
def load_middleware(self) -> None: ...
|
def load_middleware(self) -> None: ...
|
||||||
def make_view_atomic(self, view: Callable) -> Callable: ...
|
def make_view_atomic(self, view: Callable) -> Callable: ...
|
||||||
def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ...
|
def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ...
|
||||||
def get_response(self, request: WSGIRequest) -> HttpResponseBase: ...
|
def get_response(self, request: HttpRequest) -> HttpResponseBase: ...
|
||||||
def process_exception_by_middleware(self, exception: Exception, request: WSGIRequest) -> HttpResponse: ...
|
def process_exception_by_middleware(self, exception: Exception, request: HttpRequest) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
from django.urls.resolvers import URLResolver
|
from django.urls.resolvers import URLResolver
|
||||||
|
|
||||||
def convert_exception_to_response(get_response: Callable) -> Callable: ...
|
def convert_exception_to_response(get_response: Callable) -> Callable: ...
|
||||||
def response_for_exception(request: WSGIRequest, exc: Exception) -> HttpResponse: ...
|
def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse: ...
|
||||||
def get_exception_response(
|
def get_exception_response(
|
||||||
request: WSGIRequest, resolver: URLResolver, status_code: int, exception: Exception, sender: None = ...
|
request: HttpRequest, resolver: URLResolver, status_code: int, exception: Exception, sender: None = ...
|
||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any): ...
|
def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any): ...
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
from typing import Any, List, Optional, Tuple
|
from typing import Any, List, Optional, Tuple
|
||||||
|
|
||||||
from django.core.mail.backends.base import BaseEmailBackend
|
from .backends.base import BaseEmailBackend
|
||||||
from django.core.mail.message import DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE
|
from .message import (
|
||||||
from django.core.mail.message import BadHeaderError as BadHeaderError
|
BadHeaderError as BadHeaderError,
|
||||||
from django.core.mail.message import EmailMessage as EmailMessage
|
DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE,
|
||||||
from django.core.mail.message import EmailMultiAlternatives as EmailMultiAlternatives
|
EmailMessage as EmailMessage,
|
||||||
from django.core.mail.message import SafeMIMEMultipart as SafeMIMEMultipart
|
EmailMultiAlternatives as EmailMultiAlternatives,
|
||||||
from django.core.mail.message import SafeMIMEText as SafeMIMEText
|
SafeMIMEMultipart as SafeMIMEMultipart,
|
||||||
from django.core.mail.message import forbid_multi_line_headers as forbid_multi_line_headers
|
SafeMIMEText as SafeMIMEText,
|
||||||
from django.core.mail.utils import DNS_NAME as DNS_NAME
|
forbid_multi_line_headers as forbid_multi_line_headers,
|
||||||
from django.core.mail.utils import CachedDnsName as CachedDnsName
|
)
|
||||||
|
from .utils import CachedDnsName as CachedDnsName, DNS_NAME as DNS_NAME
|
||||||
|
|
||||||
def get_connection(backend: Optional[str] = ..., fail_silently: bool = ..., **kwds: Any) -> BaseEmailBackend: ...
|
def get_connection(backend: Optional[str] = ..., fail_silently: bool = ..., **kwds: Any) -> BaseEmailBackend: ...
|
||||||
def send_mail(
|
def send_mail(
|
||||||
@@ -18,17 +19,17 @@ def send_mail(
|
|||||||
from_email: Optional[str],
|
from_email: Optional[str],
|
||||||
recipient_list: List[str],
|
recipient_list: List[str],
|
||||||
fail_silently: bool = ...,
|
fail_silently: bool = ...,
|
||||||
auth_user: None = ...,
|
auth_user: Optional[str] = ...,
|
||||||
auth_password: None = ...,
|
auth_password: Optional[str] = ...,
|
||||||
connection: Optional[BaseEmailBackend] = ...,
|
connection: Optional[BaseEmailBackend] = ...,
|
||||||
html_message: Optional[str] = ...,
|
html_message: Optional[str] = ...,
|
||||||
) -> int: ...
|
) -> int: ...
|
||||||
def send_mass_mail(
|
def send_mass_mail(
|
||||||
datatuple: List[Tuple[str, str, str, List[str]]],
|
datatuple: List[Tuple[str, str, str, List[str]]],
|
||||||
fail_silently: bool = ...,
|
fail_silently: bool = ...,
|
||||||
auth_user: None = ...,
|
auth_user: Optional[str] = ...,
|
||||||
auth_password: None = ...,
|
auth_password: Optional[str] = ...,
|
||||||
connection: BaseEmailBackend = ...,
|
connection: Optional[BaseEmailBackend] = ...,
|
||||||
) -> int: ...
|
) -> int: ...
|
||||||
def mail_admins(
|
def mail_admins(
|
||||||
subject: str,
|
subject: str,
|
||||||
@@ -45,4 +46,4 @@ def mail_managers(
|
|||||||
html_message: Optional[str] = ...,
|
html_message: Optional[str] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
outbox = [EmailMessage()]
|
outbox: List[EmailMessage] = ...
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import email
|
from email._policybase import Policy
|
||||||
from email.mime.message import MIMEMessage
|
from email.mime.message import MIMEMessage
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Optional, Tuple, Union, Sequence
|
||||||
|
|
||||||
from django.core.mail.backends.base import BaseEmailBackend
|
from django.core.mail.backends.base import BaseEmailBackend
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
@@ -27,14 +27,14 @@ class MIMEMixin:
|
|||||||
class SafeMIMEMessage(MIMEMixin, MIMEMessage):
|
class SafeMIMEMessage(MIMEMixin, MIMEMessage):
|
||||||
defects: List[Any]
|
defects: List[Any]
|
||||||
epilogue: None
|
epilogue: None
|
||||||
policy: email._policybase.Compat32
|
policy: Policy
|
||||||
preamble: None
|
preamble: None
|
||||||
def __setitem__(self, name: str, val: str) -> None: ...
|
def __setitem__(self, name: str, val: str) -> None: ...
|
||||||
|
|
||||||
class SafeMIMEText(MIMEMixin, MIMEText):
|
class SafeMIMEText(MIMEMixin, MIMEText):
|
||||||
defects: List[Any]
|
defects: List[Any]
|
||||||
epilogue: None
|
epilogue: None
|
||||||
policy: email._policybase.Compat32
|
policy: Policy
|
||||||
preamble: None
|
preamble: None
|
||||||
encoding: str = ...
|
encoding: str = ...
|
||||||
def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ...
|
def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ...
|
||||||
@@ -44,7 +44,7 @@ class SafeMIMEText(MIMEMixin, MIMEText):
|
|||||||
class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
|
class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
|
||||||
defects: List[Any]
|
defects: List[Any]
|
||||||
epilogue: None
|
epilogue: None
|
||||||
policy: email._policybase.Compat32
|
policy: Policy
|
||||||
preamble: None
|
preamble: None
|
||||||
encoding: str = ...
|
encoding: str = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -71,12 +71,12 @@ class EmailMessage:
|
|||||||
subject: str = ...,
|
subject: str = ...,
|
||||||
body: Optional[str] = ...,
|
body: Optional[str] = ...,
|
||||||
from_email: Optional[str] = ...,
|
from_email: Optional[str] = ...,
|
||||||
to: Optional[Union[List[str], Tuple[str, str], str]] = ...,
|
to: Optional[Union[Sequence[str], str]] = ...,
|
||||||
bcc: Optional[Union[List[str], Tuple[str], str]] = ...,
|
bcc: Optional[Union[Sequence[str], str]] = ...,
|
||||||
connection: Optional[BaseEmailBackend] = ...,
|
connection: Optional[BaseEmailBackend] = ...,
|
||||||
attachments: Optional[Union[List[Tuple[str, str]], List[MIMEText]]] = ...,
|
attachments: Optional[Union[List[Tuple[str, str]], List[MIMEText]]] = ...,
|
||||||
headers: Optional[Dict[str, str]] = ...,
|
headers: Optional[Dict[str, str]] = ...,
|
||||||
cc: Optional[Union[List[str], Tuple[str, str], str]] = ...,
|
cc: Optional[Union[Sequence[str], str]] = ...,
|
||||||
reply_to: Optional[Union[List[Optional[str]], str]] = ...,
|
reply_to: Optional[Union[List[Optional[str]], str]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def get_connection(self, fail_silently: bool = ...) -> BaseEmailBackend: ...
|
def get_connection(self, fail_silently: bool = ...) -> BaseEmailBackend: ...
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ class Node:
|
|||||||
parents: Set[Any] = ...
|
parents: Set[Any] = ...
|
||||||
def __init__(self, key: Tuple[str, str]) -> None: ...
|
def __init__(self, key: Tuple[str, str]) -> None: ...
|
||||||
def __lt__(self, other: Union[Tuple[str, str], Node]) -> bool: ...
|
def __lt__(self, other: Union[Tuple[str, str], Node]) -> bool: ...
|
||||||
def __hash__(self) -> int: ...
|
|
||||||
def __getitem__(self, item: int) -> str: ...
|
def __getitem__(self, item: int) -> str: ...
|
||||||
def add_child(self, child: Node) -> None: ...
|
def add_child(self, child: Node) -> None: ...
|
||||||
def add_parent(self, parent: Node) -> None: ...
|
def add_parent(self, parent: Node) -> None: ...
|
||||||
@@ -19,13 +18,9 @@ class Node:
|
|||||||
def descendants(self) -> List[Tuple[str, str]]: ...
|
def descendants(self) -> List[Tuple[str, str]]: ...
|
||||||
|
|
||||||
class DummyNode(Node):
|
class DummyNode(Node):
|
||||||
children: Set[Any]
|
|
||||||
key: Tuple[str, str]
|
|
||||||
parents: Set[Any]
|
|
||||||
origin: Any = ...
|
origin: Any = ...
|
||||||
error_message: Any = ...
|
error_message: Any = ...
|
||||||
def __init__(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ...
|
def __init__(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ...
|
||||||
__class__: Any = ...
|
|
||||||
def promote(self) -> None: ...
|
def promote(self) -> None: ...
|
||||||
def raise_error(self) -> None: ...
|
def raise_error(self) -> None: ...
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from typing import Any, Dict, Optional, Set, Tuple, Union, Sequence
|
from typing import Any, Dict, Optional, Sequence, Set, Tuple, Union
|
||||||
|
|
||||||
from django.db import DefaultConnectionProxy
|
|
||||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
|
||||||
from django.db.migrations.migration import Migration, SwappableTuple
|
from django.db.migrations.migration import Migration, SwappableTuple
|
||||||
from django.db.migrations.state import ProjectState
|
from django.db.migrations.state import ProjectState
|
||||||
|
|
||||||
|
from django.db import DefaultConnectionProxy
|
||||||
|
|
||||||
MIGRATIONS_MODULE_NAME: str
|
MIGRATIONS_MODULE_NAME: str
|
||||||
|
|
||||||
class MigrationLoader:
|
class MigrationLoader:
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class Migration:
|
|||||||
name: str = ...
|
name: str = ...
|
||||||
app_label: str = ...
|
app_label: str = ...
|
||||||
def __init__(self, name: str, app_label: str) -> None: ...
|
def __init__(self, name: str, app_label: str) -> None: ...
|
||||||
def __hash__(self) -> int: ...
|
|
||||||
def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ...
|
def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ...
|
||||||
def apply(
|
def apply(
|
||||||
self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ...
|
self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ...
|
||||||
@@ -24,6 +23,6 @@ class Migration:
|
|||||||
|
|
||||||
class SwappableTuple(tuple):
|
class SwappableTuple(tuple):
|
||||||
setting: str = ...
|
setting: str = ...
|
||||||
def __new__(cls: Type[SwappableTuple], value: Tuple[str, str], setting: str) -> SwappableTuple: ...
|
def __new__(cls, value: Tuple[str, str], setting: str) -> SwappableTuple: ...
|
||||||
|
|
||||||
def swappable_dependency(value: str) -> SwappableTuple: ...
|
def swappable_dependency(value: str) -> SwappableTuple: ...
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
# Stubs for django.db.migrations.operations (Python 3.6)
|
|
||||||
#
|
|
||||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
|
||||||
|
|
||||||
from .fields import (
|
from .fields import (
|
||||||
AddField as AddField,
|
AddField as AddField,
|
||||||
AlterField as AlterField,
|
AlterField as AlterField,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, List, Optional, Type
|
from typing import Any, List
|
||||||
|
|
||||||
class Operation:
|
class Operation:
|
||||||
reversible: bool = ...
|
reversible: bool = ...
|
||||||
@@ -6,7 +6,6 @@ class Operation:
|
|||||||
atomic: bool = ...
|
atomic: bool = ...
|
||||||
elidable: bool = ...
|
elidable: bool = ...
|
||||||
serialization_expand_args: Any = ...
|
serialization_expand_args: Any = ...
|
||||||
def __new__(cls: Type[Operation], *args: Any, **kwargs: Any) -> Operation: ...
|
|
||||||
def deconstruct(self): ...
|
def deconstruct(self): ...
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class ModelOperation(Operation):
|
|||||||
def name_lower(self) -> str: ...
|
def name_lower(self) -> str: ...
|
||||||
|
|
||||||
class CreateModel(ModelOperation):
|
class CreateModel(ModelOperation):
|
||||||
serialization_expand_args: Any = ...
|
|
||||||
fields: Sequence[Tuple[str, Field]] = ...
|
fields: Sequence[Tuple[str, Field]] = ...
|
||||||
options: Any = ...
|
options: Any = ...
|
||||||
bases: Optional[Sequence[Union[type, str]]] = ...
|
bases: Optional[Sequence[Union[type, str]]] = ...
|
||||||
@@ -46,12 +45,12 @@ class FieldRelatedOptionOperation(ModelOptionOperation): ...
|
|||||||
class AlterUniqueTogether(FieldRelatedOptionOperation):
|
class AlterUniqueTogether(FieldRelatedOptionOperation):
|
||||||
option_name: str = ...
|
option_name: str = ...
|
||||||
unique_together: Collection[Sequence[str]] = ...
|
unique_together: Collection[Sequence[str]] = ...
|
||||||
def __init__(self, name: str, unique_together: Collection[Sequence[str]]) -> None: ...
|
def __init__(self, name: str, unique_together: Optional[Collection[Sequence[str]]]) -> None: ...
|
||||||
|
|
||||||
class AlterIndexTogether(FieldRelatedOptionOperation):
|
class AlterIndexTogether(FieldRelatedOptionOperation):
|
||||||
option_name: str = ...
|
option_name: str = ...
|
||||||
index_together: Collection[Sequence[str]] = ...
|
index_together: Collection[Sequence[str]] = ...
|
||||||
def __init__(self, name: str, index_together: Collection[Sequence[str]]) -> None: ...
|
def __init__(self, name: str, index_together: Optional[Collection[Sequence[str]]]) -> None: ...
|
||||||
|
|
||||||
class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
|
class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
|
||||||
order_with_respect_to: str = ...
|
order_with_respect_to: str = ...
|
||||||
@@ -63,7 +62,6 @@ class AlterModelOptions(ModelOptionOperation):
|
|||||||
def __init__(self, name: str, options: Dict[str, Any]) -> None: ...
|
def __init__(self, name: str, options: Dict[str, Any]) -> None: ...
|
||||||
|
|
||||||
class AlterModelManagers(ModelOptionOperation):
|
class AlterModelManagers(ModelOptionOperation):
|
||||||
serialization_expand_args: Any = ...
|
|
||||||
managers: Any = ...
|
managers: Any = ...
|
||||||
def __init__(self, name: Any, managers: Any) -> None: ...
|
def __init__(self, name: Any, managers: Any) -> None: ...
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional, Sequence, Dict
|
from typing import Any, Callable, Dict, Optional, Sequence
|
||||||
|
|
||||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
@@ -6,7 +6,6 @@ from django.db.migrations.state import StateApps
|
|||||||
from .base import Operation
|
from .base import Operation
|
||||||
|
|
||||||
class SeparateDatabaseAndState(Operation):
|
class SeparateDatabaseAndState(Operation):
|
||||||
serialization_expand_args: Any = ...
|
|
||||||
database_operations: Sequence[Operation] = ...
|
database_operations: Sequence[Operation] = ...
|
||||||
state_operations: Sequence[Operation] = ...
|
state_operations: Sequence[Operation] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -19,7 +18,6 @@ class RunSQL(Operation):
|
|||||||
reverse_sql: Any = ...
|
reverse_sql: Any = ...
|
||||||
state_operations: Any = ...
|
state_operations: Any = ...
|
||||||
hints: Any = ...
|
hints: Any = ...
|
||||||
elidable: Any = ...
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
sql: Any,
|
sql: Any,
|
||||||
@@ -30,12 +28,9 @@ class RunSQL(Operation):
|
|||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
class RunPython(Operation):
|
class RunPython(Operation):
|
||||||
reduces_to_sql: bool = ...
|
|
||||||
atomic: bool = ...
|
|
||||||
code: Callable = ...
|
code: Callable = ...
|
||||||
reverse_code: Optional[Callable] = ...
|
reverse_code: Optional[Callable] = ...
|
||||||
hints: Optional[Dict[str, Any]] = ...
|
hints: Optional[Dict[str, Any]] = ...
|
||||||
elidable: bool = ...
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
code: Callable,
|
code: Callable,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from typing import Any, Optional
|
|
||||||
|
|
||||||
from django.db.migrations.state import ProjectState
|
from django.db.migrations.state import ProjectState
|
||||||
|
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
|
|
||||||
def is_referenced_by_foreign_key(state: ProjectState, model_name_lower: str, field: Field, field_name: str) -> bool: ...
|
def is_referenced_by_foreign_key(state: ProjectState, model_name_lower: str, field: Field, field_name: str) -> bool: ...
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from typing import Any, List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from django.db.migrations.operations.base import Operation
|
from django.db.migrations.operations.base import Operation
|
||||||
|
|
||||||
class MigrationOptimizer:
|
class MigrationOptimizer:
|
||||||
def optimize(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ...
|
def optimize(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ...
|
||||||
def optimize_inner(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ...
|
def optimize_inner(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ...
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
from typing import Any, Dict, Optional, Set
|
from typing import Any, Dict, Optional, Set
|
||||||
|
|
||||||
from django.db.migrations.state import ModelState
|
from django.db.migrations.state import ModelState
|
||||||
|
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
|
|
||||||
from .loader import MigrationLoader
|
|
||||||
|
|
||||||
class MigrationQuestioner:
|
class MigrationQuestioner:
|
||||||
defaults: Dict[Any, Any] = ...
|
defaults: Dict[str, Any] = ...
|
||||||
specified_apps: Set[Any] = ...
|
specified_apps: Set[str] = ...
|
||||||
dry_run: None = ...
|
dry_run: Optional[bool] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
defaults: Optional[Dict[str, bool]] = ...,
|
defaults: Optional[Dict[str, bool]] = ...,
|
||||||
@@ -23,21 +22,5 @@ class MigrationQuestioner:
|
|||||||
def ask_merge(self, app_label: str) -> bool: ...
|
def ask_merge(self, app_label: str) -> bool: ...
|
||||||
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ...
|
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ...
|
||||||
|
|
||||||
class InteractiveMigrationQuestioner(MigrationQuestioner):
|
class InteractiveMigrationQuestioner(MigrationQuestioner): ...
|
||||||
defaults: Dict[Any, Any]
|
class NonInteractiveMigrationQuestioner(MigrationQuestioner): ...
|
||||||
dry_run: bool
|
|
||||||
specified_apps: Set[str]
|
|
||||||
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
|
|
||||||
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
|
|
||||||
def ask_rename(self, model_name: Any, old_name: Any, new_name: Any, field_instance: Any): ...
|
|
||||||
def ask_rename_model(self, old_model_state: Any, new_model_state: Any): ...
|
|
||||||
def ask_merge(self, app_label: str) -> bool: ...
|
|
||||||
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> int: ...
|
|
||||||
|
|
||||||
class NonInteractiveMigrationQuestioner(MigrationQuestioner):
|
|
||||||
defaults: Dict[Any, Any]
|
|
||||||
dry_run: bool
|
|
||||||
specified_apps: Set[str]
|
|
||||||
def ask_not_null_addition(self, field_name: Any, model_name: Any) -> None: ...
|
|
||||||
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
|
|
||||||
def ask_auto_now_add_addition(self, field_name: Any, model_name: Any) -> None: ...
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
from typing import Any, Optional, Set, Tuple, Union
|
from typing import Any, Optional, Set, Tuple
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
class MigrationRecorder:
|
class MigrationRecorder:
|
||||||
class Migration(models.Model):
|
class Migration(models.Model):
|
||||||
app: Any = ...
|
app: Any = ...
|
||||||
|
|||||||
@@ -1,88 +1,40 @@
|
|||||||
from typing import Any, Callable, Dict, List, Set, Tuple, Union
|
from typing import Any, Callable, Dict, List, Set, Tuple, Union
|
||||||
|
|
||||||
from django.db.models.fields import Field
|
|
||||||
|
|
||||||
class BaseSerializer:
|
class BaseSerializer:
|
||||||
value: Any = ...
|
value: Any = ...
|
||||||
def __init__(self, value: Any) -> None: ...
|
def __init__(self, value: Any) -> None: ...
|
||||||
def serialize(self) -> None: ...
|
def serialize(self) -> Any: ...
|
||||||
|
|
||||||
class BaseSequenceSerializer(BaseSerializer):
|
class BaseSequenceSerializer(BaseSerializer): ...
|
||||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
class BaseSimpleSerializer(BaseSerializer): ...
|
||||||
|
class DatetimeSerializer(BaseSerializer): ...
|
||||||
class BaseSimpleSerializer(BaseSerializer):
|
class DateSerializer(BaseSerializer): ...
|
||||||
value: str
|
class DecimalSerializer(BaseSerializer): ...
|
||||||
def serialize(self) -> Tuple[str, Set[Any]]: ...
|
|
||||||
|
|
||||||
class DatetimeSerializer(BaseSerializer):
|
|
||||||
value: Any = ...
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class DateSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class DecimalSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class DeconstructableSerializer(BaseSerializer):
|
class DeconstructableSerializer(BaseSerializer):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def serialize_deconstructed(
|
def serialize_deconstructed(
|
||||||
path: str, args: List[Any], kwargs: Dict[str, Union[Callable, int, str]]
|
path: str, args: List[Any], kwargs: Dict[str, Union[Callable, int, str]]
|
||||||
) -> Tuple[str, Set[str]]: ...
|
) -> Tuple[str, Set[str]]: ...
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class DictionarySerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class EnumSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class FloatSerializer(BaseSimpleSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
|
class DictionarySerializer(BaseSerializer): ...
|
||||||
|
class EnumSerializer(BaseSerializer): ...
|
||||||
|
class FloatSerializer(BaseSimpleSerializer): ...
|
||||||
class FrozensetSerializer(BaseSequenceSerializer): ...
|
class FrozensetSerializer(BaseSequenceSerializer): ...
|
||||||
|
class FunctionTypeSerializer(BaseSerializer): ...
|
||||||
class FunctionTypeSerializer(BaseSerializer):
|
class FunctoolsPartialSerializer(BaseSerializer): ...
|
||||||
value: Callable
|
class IterableSerializer(BaseSerializer): ...
|
||||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
class ModelFieldSerializer(DeconstructableSerializer): ...
|
||||||
|
class ModelManagerSerializer(DeconstructableSerializer): ...
|
||||||
class FunctoolsPartialSerializer(BaseSerializer):
|
class OperationSerializer(BaseSerializer): ...
|
||||||
def serialize(self): ...
|
class RegexSerializer(BaseSerializer): ...
|
||||||
|
|
||||||
class IterableSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class ModelFieldSerializer(DeconstructableSerializer):
|
|
||||||
value: Field
|
|
||||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
|
||||||
|
|
||||||
class ModelManagerSerializer(DeconstructableSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class OperationSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class RegexSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class SequenceSerializer(BaseSequenceSerializer): ...
|
class SequenceSerializer(BaseSequenceSerializer): ...
|
||||||
class SetSerializer(BaseSequenceSerializer): ...
|
class SetSerializer(BaseSequenceSerializer): ...
|
||||||
|
class SettingsReferenceSerializer(BaseSerializer): ...
|
||||||
class SettingsReferenceSerializer(BaseSerializer):
|
class TimedeltaSerializer(BaseSerializer): ...
|
||||||
def serialize(self): ...
|
class TimeSerializer(BaseSerializer): ...
|
||||||
|
|
||||||
class TimedeltaSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class TimeSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class TupleSerializer(BaseSequenceSerializer): ...
|
class TupleSerializer(BaseSequenceSerializer): ...
|
||||||
|
class TypeSerializer(BaseSerializer): ...
|
||||||
class TypeSerializer(BaseSerializer):
|
class UUIDSerializer(BaseSerializer): ...
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
class UUIDSerializer(BaseSerializer):
|
|
||||||
def serialize(self): ...
|
|
||||||
|
|
||||||
def serializer_factory(value: Any) -> BaseSerializer: ...
|
def serializer_factory(value: Any) -> BaseSerializer: ...
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, DefaultDict, Union, Sequence
|
from typing import Any, DefaultDict, Dict, Iterator, List, Optional, Sequence, Tuple, Type, Union
|
||||||
|
|
||||||
from django.apps.registry import Apps
|
from django.apps.registry import Apps
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.manager import Manager
|
from django.db.models.manager import Manager
|
||||||
from django.utils.functional import cached_property
|
|
||||||
|
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
|
|
||||||
@@ -22,9 +21,9 @@ class ModelState:
|
|||||||
name: str
|
name: str
|
||||||
app_label: str
|
app_label: str
|
||||||
fields: List[Tuple[str, Field]]
|
fields: List[Tuple[str, Field]]
|
||||||
options: Optional[Dict[str, Any]] = ...
|
options: Dict[str, Any] = ...
|
||||||
bases: Optional[Tuple[Type[Model]]] = ...
|
bases: Tuple[Type[Model]] = ...
|
||||||
managers: Optional[List[Tuple[str, Manager]]] = ...
|
managers: List[Tuple[str, Manager]] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
app_label: str,
|
app_label: str,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, Iterator, List, Optional, Set
|
from typing import Dict, Iterator, List, Set
|
||||||
|
|
||||||
from django.db.migrations.operations.base import Operation
|
from django.db.migrations.operations.base import Operation
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any
|
||||||
|
|
||||||
from django.utils.functional import SimpleLazyObject
|
|
||||||
|
|
||||||
COMPILED_REGEX_TYPE: Any
|
COMPILED_REGEX_TYPE: Any
|
||||||
|
|
||||||
class RegexObject:
|
class RegexObject:
|
||||||
pattern: str = ...
|
pattern: str = ...
|
||||||
flags: int = ...
|
flags: int = ...
|
||||||
def __init__(self, obj: SimpleLazyObject) -> None: ...
|
def __init__(self, obj: Any) -> None: ...
|
||||||
|
|
||||||
def get_migration_name_timestamp() -> str: ...
|
def get_migration_name_timestamp() -> str: ...
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
from typing import Any, Optional, Set, Tuple, Type, List, Union
|
from typing import Any, List, Set, Tuple, Union
|
||||||
|
|
||||||
from django.db.migrations.migration import Migration
|
from django.db.migrations.migration import Migration
|
||||||
from django.db.migrations.operations.base import Operation
|
from django.db.migrations.operations.base import Operation
|
||||||
|
|
||||||
from django.db.migrations.operations.models import CreateModel
|
from django.db.migrations.operations.models import CreateModel
|
||||||
|
|
||||||
class SettingsReference(str):
|
class SettingsReference(str):
|
||||||
def __new__(self: Type[SettingsReference], value: str, setting_name: str) -> SettingsReference: ...
|
|
||||||
setting_name: str = ...
|
|
||||||
def __init__(self, value: str, setting_name: str) -> None: ...
|
def __init__(self, value: str, setting_name: str) -> None: ...
|
||||||
|
|
||||||
class OperationWriter:
|
class OperationWriter:
|
||||||
|
|||||||
@@ -168,12 +168,12 @@ class RawSQL(Expression):
|
|||||||
def __init__(self, sql: str, params: Sequence[Any], output_field: Optional[_OutputField] = ...) -> None: ...
|
def __init__(self, sql: str, params: Sequence[Any], output_field: Optional[_OutputField] = ...) -> None: ...
|
||||||
|
|
||||||
class Func(SQLiteNumericMixin, Expression):
|
class Func(SQLiteNumericMixin, Expression):
|
||||||
function: Any = ...
|
function: str = ...
|
||||||
template: str = ...
|
template: str = ...
|
||||||
arg_joiner: str = ...
|
arg_joiner: str = ...
|
||||||
arity: Any = ...
|
arity: int = ...
|
||||||
source_expressions: List[Expression] = ...
|
source_expressions: List[Expression] = ...
|
||||||
extra: Any = ...
|
extra: Dict[Any, Any] = ...
|
||||||
def __init__(self, *expressions: Any, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ...
|
def __init__(self, *expressions: Any, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ...
|
||||||
def get_source_expressions(self) -> List[Combinable]: ...
|
def get_source_expressions(self) -> List[Combinable]: ...
|
||||||
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
|
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
import uuid
|
|
||||||
from datetime import date, time, datetime, timedelta
|
|
||||||
from typing import Any, Optional, Tuple, Iterable, Callable, Dict, Union, Type, TypeVar, Generic
|
|
||||||
import decimal
|
import decimal
|
||||||
|
import uuid
|
||||||
from typing_extensions import Literal
|
from datetime import date, datetime, time, timedelta
|
||||||
|
from typing import Any, Callable, Dict, Generic, Iterable, Optional, Tuple, Type, TypeVar, Union
|
||||||
|
|
||||||
from django.db.models import Model
|
from django.db.models import Model
|
||||||
from django.db.models.query_utils import RegisterLookupMixin
|
|
||||||
|
|
||||||
from django.db.models.expressions import F, Combinable
|
|
||||||
from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist
|
from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist
|
||||||
from django.forms import Widget, Field as FormField
|
from django.db.models.expressions import Combinable
|
||||||
|
from django.db.models.query_utils import RegisterLookupMixin
|
||||||
|
from django.forms import Field as FormField, Widget
|
||||||
|
|
||||||
from .mixins import NOT_PROVIDED as NOT_PROVIDED
|
from .mixins import NOT_PROVIDED as NOT_PROVIDED
|
||||||
|
|
||||||
_Choice = Tuple[Any, Any]
|
_Choice = Tuple[Any, Any]
|
||||||
@@ -20,7 +18,15 @@ _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]]
|
|||||||
_ValidatorCallable = Callable[..., None]
|
_ValidatorCallable = Callable[..., None]
|
||||||
_ErrorMessagesToOverride = Dict[str, Any]
|
_ErrorMessagesToOverride = Dict[str, Any]
|
||||||
|
|
||||||
class Field(RegisterLookupMixin):
|
# __set__ value type
|
||||||
|
_ST = TypeVar("_ST")
|
||||||
|
# __get__ return type
|
||||||
|
_GT = TypeVar("_GT")
|
||||||
|
|
||||||
|
class Field(RegisterLookupMixin, Generic[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Any
|
||||||
|
_pyi_private_get_type: Any
|
||||||
|
|
||||||
widget: Widget
|
widget: Widget
|
||||||
help_text: str
|
help_text: str
|
||||||
db_table: str
|
db_table: str
|
||||||
@@ -52,7 +58,8 @@ class Field(RegisterLookupMixin):
|
|||||||
validators: Iterable[_ValidatorCallable] = ...,
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
def __get__(self, instance, owner) -> Any: ...
|
def __set__(self, instance, value: _ST) -> None: ...
|
||||||
|
def __get__(self, instance, owner) -> _GT: ...
|
||||||
def deconstruct(self) -> Any: ...
|
def deconstruct(self) -> Any: ...
|
||||||
def set_attributes_from_name(self, name: str) -> None: ...
|
def set_attributes_from_name(self, name: str) -> None: ...
|
||||||
def db_type(self, connection: Any) -> str: ...
|
def db_type(self, connection: Any) -> str: ...
|
||||||
@@ -63,23 +70,25 @@ class Field(RegisterLookupMixin):
|
|||||||
def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ...) -> None: ...
|
def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ...) -> None: ...
|
||||||
def to_python(self, value: Any) -> Any: ...
|
def to_python(self, value: Any) -> Any: ...
|
||||||
|
|
||||||
class IntegerField(Field):
|
class IntegerField(Field[_ST, _GT]):
|
||||||
def __set__(self, instance, value: Union[int, Combinable, Literal[""]]) -> None: ...
|
_pyi_private_set_type: Union[float, int, str, Combinable]
|
||||||
def __get__(self, instance, owner) -> int: ...
|
_pyi_private_get_type: int
|
||||||
|
|
||||||
class PositiveIntegerRelDbTypeMixin:
|
class PositiveIntegerRelDbTypeMixin:
|
||||||
def rel_db_type(self, connection: Any): ...
|
def rel_db_type(self, connection: Any): ...
|
||||||
|
|
||||||
class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ...
|
class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): ...
|
||||||
class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ...
|
class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): ...
|
||||||
class SmallIntegerField(IntegerField): ...
|
class SmallIntegerField(IntegerField[_ST, _GT]): ...
|
||||||
class BigIntegerField(IntegerField): ...
|
class BigIntegerField(IntegerField[_ST, _GT]): ...
|
||||||
|
|
||||||
class FloatField(Field):
|
class FloatField(Field[_ST, _GT]):
|
||||||
def __set__(self, instance, value: Union[float, int, str, Combinable]) -> float: ...
|
_pyi_private_set_type: Union[float, int, str, Combinable]
|
||||||
def __get__(self, instance, owner) -> float: ...
|
_pyi_private_get_type: float
|
||||||
|
|
||||||
class DecimalField(Field):
|
class DecimalField(Field[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Union[str, float, decimal.Decimal, Combinable]
|
||||||
|
_pyi_private_get_type: decimal.Decimal
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: Optional[Union[str, bytes]] = ...,
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
@@ -102,13 +111,14 @@ class DecimalField(Field):
|
|||||||
validators: Iterable[_ValidatorCallable] = ...,
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
def __set__(self, instance, value: Union[str, float, decimal.Decimal, Combinable]) -> decimal.Decimal: ...
|
|
||||||
def __get__(self, instance, owner) -> decimal.Decimal: ...
|
|
||||||
|
|
||||||
class AutoField(Field):
|
class AutoField(Field[_ST, _GT]):
|
||||||
def __get__(self, instance, owner) -> int: ...
|
_pyi_private_set_type: Union[Combinable, int, str]
|
||||||
|
_pyi_private_get_type: int
|
||||||
|
|
||||||
class CharField(Field):
|
class CharField(Field[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Union[str, int, Combinable]
|
||||||
|
_pyi_private_get_type: str
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: Optional[Union[str, bytes]] = ...,
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
@@ -133,10 +143,8 @@ class CharField(Field):
|
|||||||
validators: Iterable[_ValidatorCallable] = ...,
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
def __set__(self, instance, value: Union[str, int, Combinable]) -> None: ...
|
|
||||||
def __get__(self, instance, owner) -> str: ...
|
|
||||||
|
|
||||||
class SlugField(CharField):
|
class SlugField(CharField[_ST, _GT]):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: Optional[Union[str, bytes]] = ...,
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
@@ -163,25 +171,29 @@ class SlugField(CharField):
|
|||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
|
|
||||||
class EmailField(CharField): ...
|
class EmailField(CharField[_ST, _GT]): ...
|
||||||
class URLField(CharField): ...
|
class URLField(CharField[_ST, _GT]): ...
|
||||||
|
|
||||||
class TextField(Field):
|
class TextField(Field[_ST, _GT]):
|
||||||
def __set__(self, instance, value: Union[str, Combinable]) -> None: ...
|
_pyi_private_set_type: Union[str, Combinable]
|
||||||
def __get__(self, instance, owner) -> str: ...
|
_pyi_private_get_type: str
|
||||||
|
|
||||||
class BooleanField(Field):
|
class BooleanField(Field[_ST, _GT]):
|
||||||
def __set__(self, instance, value: Union[bool, Combinable]) -> None: ...
|
_pyi_private_set_type: Union[bool, Combinable]
|
||||||
def __get__(self, instance, owner) -> bool: ...
|
_pyi_private_get_type: bool
|
||||||
|
|
||||||
class NullBooleanField(Field):
|
class NullBooleanField(Field[_ST, _GT]):
|
||||||
def __set__(self, instance, value: Optional[Union[bool, Combinable]]) -> None: ...
|
_pyi_private_set_type: Optional[Union[bool, Combinable]]
|
||||||
def __get__(self, instance, owner) -> Optional[bool]: ...
|
_pyi_private_get_type: Optional[bool]
|
||||||
|
|
||||||
class IPAddressField(Field):
|
class IPAddressField(Field[_ST, _GT]):
|
||||||
def __get__(self, instance, owner) -> str: ...
|
_pyi_private_set_type: Union[str, Combinable]
|
||||||
|
_pyi_private_get_type: str
|
||||||
|
|
||||||
|
class GenericIPAddressField(Field[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Union[str, int, Callable[..., Any], Combinable]
|
||||||
|
_pyi_private_get_type: str
|
||||||
|
|
||||||
class GenericIPAddressField(Field):
|
|
||||||
default_error_messages: Any = ...
|
default_error_messages: Any = ...
|
||||||
unpack_ipv4: Any = ...
|
unpack_ipv4: Any = ...
|
||||||
protocol: Any = ...
|
protocol: Any = ...
|
||||||
@@ -207,11 +219,12 @@ class GenericIPAddressField(Field):
|
|||||||
validators: Iterable[_ValidatorCallable] = ...,
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __get__(self, instance, owner) -> str: ...
|
|
||||||
|
|
||||||
class DateTimeCheckMixin: ...
|
class DateTimeCheckMixin: ...
|
||||||
|
|
||||||
class DateField(DateTimeCheckMixin, Field):
|
class DateField(DateTimeCheckMixin, Field[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Union[str, date, Combinable]
|
||||||
|
_pyi_private_get_type: date
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: Optional[Union[str, bytes]] = ...,
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
@@ -235,10 +248,10 @@ class DateField(DateTimeCheckMixin, Field):
|
|||||||
validators: Iterable[_ValidatorCallable] = ...,
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
def __set__(self, instance, value: Union[str, date, Combinable]) -> None: ...
|
|
||||||
def __get__(self, instance, owner) -> date: ...
|
|
||||||
|
|
||||||
class TimeField(DateTimeCheckMixin, Field):
|
class TimeField(DateTimeCheckMixin, Field[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Union[str, time, datetime, Combinable]
|
||||||
|
_pyi_private_get_type: time
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: Optional[Union[str, bytes]] = ...,
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
@@ -261,18 +274,15 @@ class TimeField(DateTimeCheckMixin, Field):
|
|||||||
validators: Iterable[_ValidatorCallable] = ...,
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
def __set__(self, instance, value: Union[str, time, datetime, Combinable]) -> None: ...
|
|
||||||
def __get__(self, instance, owner) -> time: ...
|
|
||||||
|
|
||||||
class DateTimeField(DateField):
|
class DateTimeField(DateField[_ST, _GT]):
|
||||||
def __set__(self, instance, value: Union[str, date, datetime, Combinable]) -> None: ...
|
_pyi_private_get_type: datetime
|
||||||
def __get__(self, instance, owner) -> datetime: ...
|
|
||||||
|
|
||||||
class UUIDField(Field):
|
class UUIDField(Field[_ST, _GT]):
|
||||||
def __set__(self, instance, value: Any) -> None: ...
|
_pyi_private_set_type: Union[str, uuid.UUID]
|
||||||
def __get__(self, instance, owner) -> uuid.UUID: ...
|
_pyi_private_get_type: uuid.UUID
|
||||||
|
|
||||||
class FilePathField(Field):
|
class FilePathField(Field[_ST, _GT]):
|
||||||
path: str = ...
|
path: str = ...
|
||||||
match: Optional[Any] = ...
|
match: Optional[Any] = ...
|
||||||
recursive: bool = ...
|
recursive: bool = ...
|
||||||
@@ -305,10 +315,10 @@ class FilePathField(Field):
|
|||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
|
|
||||||
class BinaryField(Field): ...
|
class BinaryField(Field[_ST, _GT]): ...
|
||||||
|
|
||||||
class DurationField(Field):
|
class DurationField(Field[_ST, _GT]):
|
||||||
def __get__(self, instance, owner) -> timedelta: ...
|
_pyi_private_get_type: timedelta
|
||||||
|
|
||||||
class BigAutoField(AutoField): ...
|
class BigAutoField(AutoField[_ST, _GT]): ...
|
||||||
class CommaSeparatedIntegerField(CharField): ...
|
class CommaSeparatedIntegerField(CharField[_ST, _GT]): ...
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from django.db.models.fields.reverse_related import (
|
|||||||
)
|
)
|
||||||
from django.db.models.query_utils import PathInfo, Q
|
from django.db.models.query_utils import PathInfo, Q
|
||||||
|
|
||||||
from django.db.models.expressions import F
|
from django.db.models.expressions import Combinable
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django.db.models.manager import RelatedManager
|
from django.db.models.manager import RelatedManager
|
||||||
@@ -49,7 +49,12 @@ _ErrorMessagesToOverride = Dict[str, Any]
|
|||||||
|
|
||||||
RECURSIVE_RELATIONSHIP_CONSTANT: str = ...
|
RECURSIVE_RELATIONSHIP_CONSTANT: str = ...
|
||||||
|
|
||||||
class RelatedField(FieldCacheMixin, Field):
|
# __set__ value type
|
||||||
|
_ST = TypeVar("_ST")
|
||||||
|
# __get__ return type
|
||||||
|
_GT = TypeVar("_GT")
|
||||||
|
|
||||||
|
class RelatedField(FieldCacheMixin, Field[_ST, _GT]):
|
||||||
one_to_many: bool = ...
|
one_to_many: bool = ...
|
||||||
one_to_one: bool = ...
|
one_to_one: bool = ...
|
||||||
many_to_many: bool = ...
|
many_to_many: bool = ...
|
||||||
@@ -83,6 +88,7 @@ class ForeignObject(RelatedField):
|
|||||||
related_query_name: None = ...,
|
related_query_name: None = ...,
|
||||||
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
|
||||||
parent_link: bool = ...,
|
parent_link: bool = ...,
|
||||||
|
db_constraint: bool = ...,
|
||||||
swappable: bool = ...,
|
swappable: bool = ...,
|
||||||
verbose_name: Optional[str] = ...,
|
verbose_name: Optional[str] = ...,
|
||||||
name: Optional[str] = ...,
|
name: Optional[str] = ...,
|
||||||
@@ -103,16 +109,82 @@ class ForeignObject(RelatedField):
|
|||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
|
|
||||||
class ForeignKey(RelatedField, Generic[_T]):
|
class ForeignKey(RelatedField[_ST, _GT]):
|
||||||
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ...
|
_pyi_private_set_type: Union[Any, Combinable]
|
||||||
def __set__(self, instance, value: Union[Model, F]) -> None: ...
|
_pyi_private_get_type: Any
|
||||||
def __get__(self, instance, owner) -> _T: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
to: Union[Type[Model], str],
|
||||||
|
on_delete: Callable[..., None],
|
||||||
|
to_field: Optional[str] = ...,
|
||||||
|
related_name: str = ...,
|
||||||
|
related_query_name: Optional[str] = ...,
|
||||||
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
|
||||||
|
parent_link: bool = ...,
|
||||||
|
db_constraint: bool = ...,
|
||||||
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
primary_key: bool = ...,
|
||||||
|
max_length: Optional[int] = ...,
|
||||||
|
unique: bool = ...,
|
||||||
|
blank: bool = ...,
|
||||||
|
null: bool = ...,
|
||||||
|
db_index: bool = ...,
|
||||||
|
default: Any = ...,
|
||||||
|
editable: bool = ...,
|
||||||
|
auto_created: bool = ...,
|
||||||
|
serialize: bool = ...,
|
||||||
|
unique_for_date: Optional[str] = ...,
|
||||||
|
unique_for_month: Optional[str] = ...,
|
||||||
|
unique_for_year: Optional[str] = ...,
|
||||||
|
choices: Optional[_FieldChoices] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
db_column: Optional[str] = ...,
|
||||||
|
db_tablespace: Optional[str] = ...,
|
||||||
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
|
): ...
|
||||||
|
|
||||||
class OneToOneField(RelatedField, Generic[_T]):
|
class OneToOneField(RelatedField[_ST, _GT]):
|
||||||
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ...
|
_pyi_private_set_type: Union[Any, Combinable]
|
||||||
def __get__(self, instance, owner) -> _T: ...
|
_pyi_private_get_type: Any
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
to: Union[Type[Model], str],
|
||||||
|
on_delete: Any,
|
||||||
|
to_field: Optional[str] = ...,
|
||||||
|
related_name: str = ...,
|
||||||
|
related_query_name: Optional[str] = ...,
|
||||||
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
|
||||||
|
parent_link: bool = ...,
|
||||||
|
db_constraint: bool = ...,
|
||||||
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
primary_key: bool = ...,
|
||||||
|
max_length: Optional[int] = ...,
|
||||||
|
unique: bool = ...,
|
||||||
|
blank: bool = ...,
|
||||||
|
null: bool = ...,
|
||||||
|
db_index: bool = ...,
|
||||||
|
default: Any = ...,
|
||||||
|
editable: bool = ...,
|
||||||
|
auto_created: bool = ...,
|
||||||
|
serialize: bool = ...,
|
||||||
|
unique_for_date: Optional[str] = ...,
|
||||||
|
unique_for_month: Optional[str] = ...,
|
||||||
|
unique_for_year: Optional[str] = ...,
|
||||||
|
choices: Optional[_FieldChoices] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
db_column: Optional[str] = ...,
|
||||||
|
db_tablespace: Optional[str] = ...,
|
||||||
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
|
): ...
|
||||||
|
|
||||||
|
class ManyToManyField(RelatedField[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Sequence[Any]
|
||||||
|
_pyi_private_get_type: RelatedManager[Any]
|
||||||
|
|
||||||
class ManyToManyField(RelatedField, Generic[_T]):
|
|
||||||
many_to_many: bool = ...
|
many_to_many: bool = ...
|
||||||
many_to_one: bool = ...
|
many_to_one: bool = ...
|
||||||
one_to_many: bool = ...
|
one_to_many: bool = ...
|
||||||
@@ -126,17 +198,35 @@ class ManyToManyField(RelatedField, Generic[_T]):
|
|||||||
to: Union[Type[_T], str],
|
to: Union[Type[_T], str],
|
||||||
related_name: Optional[str] = ...,
|
related_name: Optional[str] = ...,
|
||||||
related_query_name: Optional[str] = ...,
|
related_query_name: Optional[str] = ...,
|
||||||
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
|
||||||
symmetrical: Optional[bool] = ...,
|
symmetrical: Optional[bool] = ...,
|
||||||
through: Optional[Union[str, Type[Model]]] = ...,
|
through: Optional[Union[str, Type[Model]]] = ...,
|
||||||
through_fields: Optional[Tuple[str, str]] = ...,
|
through_fields: Optional[Tuple[str, str]] = ...,
|
||||||
db_constraint: bool = ...,
|
db_constraint: bool = ...,
|
||||||
db_table: Optional[str] = ...,
|
db_table: Optional[str] = ...,
|
||||||
swappable: bool = ...,
|
swappable: bool = ...,
|
||||||
**kwargs: Any
|
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
primary_key: bool = ...,
|
||||||
|
max_length: Optional[int] = ...,
|
||||||
|
unique: bool = ...,
|
||||||
|
blank: bool = ...,
|
||||||
|
null: bool = ...,
|
||||||
|
db_index: bool = ...,
|
||||||
|
default: Any = ...,
|
||||||
|
editable: bool = ...,
|
||||||
|
auto_created: bool = ...,
|
||||||
|
serialize: bool = ...,
|
||||||
|
unique_for_date: Optional[str] = ...,
|
||||||
|
unique_for_month: Optional[str] = ...,
|
||||||
|
unique_for_year: Optional[str] = ...,
|
||||||
|
choices: Optional[_FieldChoices] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
db_column: Optional[str] = ...,
|
||||||
|
db_tablespace: Optional[str] = ...,
|
||||||
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __set__(self, instance, value: Sequence[_T]) -> None: ...
|
|
||||||
def __get__(self, instance, owner) -> RelatedManager[_T]: ...
|
|
||||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||||
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
|
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
|
||||||
def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
|
def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
|
||||||
|
|||||||
@@ -9,22 +9,19 @@ class CumeDist(Func):
|
|||||||
window_compatible: bool = ...
|
window_compatible: bool = ...
|
||||||
|
|
||||||
class DenseRank(Func):
|
class DenseRank(Func):
|
||||||
extra: Dict[Any, Any]
|
|
||||||
source_expressions: List[Any]
|
|
||||||
function: str = ...
|
|
||||||
name: str = ...
|
name: str = ...
|
||||||
output_field: Any = ...
|
output_field: Any = ...
|
||||||
window_compatible: bool = ...
|
window_compatible: bool = ...
|
||||||
|
|
||||||
class FirstValue(Func):
|
class FirstValue(Func):
|
||||||
arity: int = ...
|
|
||||||
function: str = ...
|
|
||||||
name: str = ...
|
name: str = ...
|
||||||
window_compatible: bool = ...
|
window_compatible: bool = ...
|
||||||
|
|
||||||
class LagLeadFunction(Func):
|
class LagLeadFunction(Func):
|
||||||
window_compatible: bool = ...
|
window_compatible: bool = ...
|
||||||
def __init__(self, expression: Optional[str], offset: int = ..., default: None = ..., **extra: Any) -> Any: ...
|
def __init__(
|
||||||
|
self, expression: Optional[str], offset: int = ..., default: Optional[int] = ..., **extra: Any
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class Lag(LagLeadFunction):
|
class Lag(LagLeadFunction):
|
||||||
function: str = ...
|
function: str = ...
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from django.db.models.base import Model
|
|||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
_T = TypeVar("_T", bound=Model, covariant=True)
|
_T = TypeVar("_T", bound=Model, covariant=True)
|
||||||
_Self = TypeVar("_Self", bound="BaseManager")
|
|
||||||
|
|
||||||
class BaseManager(QuerySet[_T]):
|
class BaseManager(QuerySet[_T]):
|
||||||
creation_counter: int = ...
|
creation_counter: int = ...
|
||||||
@@ -17,7 +16,7 @@ class BaseManager(QuerySet[_T]):
|
|||||||
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
|
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
|
||||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_queryset(cls: Type[_Self], queryset_class: Any, class_name: Optional[Any] = ...) -> Type[_Self]: ...
|
def from_queryset(cls, queryset_class: Type[QuerySet], class_name: Optional[str] = ...) -> Any: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_queryset_methods(cls, queryset_class: type) -> Dict[str, Any]: ...
|
def _get_queryset_methods(cls, queryset_class: type) -> Dict[str, Any]: ...
|
||||||
def contribute_to_class(self, model: Type[Model], name: str) -> None: ...
|
def contribute_to_class(self, model: Type[Model], name: str) -> None: ...
|
||||||
|
|||||||
@@ -84,9 +84,7 @@ class QuerySet(Iterable[_T], Sized):
|
|||||||
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
||||||
def first(self) -> Optional[_T]: ...
|
def first(self) -> Optional[_T]: ...
|
||||||
def last(self) -> Optional[_T]: ...
|
def last(self) -> Optional[_T]: ...
|
||||||
def in_bulk(
|
def in_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ...
|
||||||
self, id_list: Any = ..., *, field_name: str = ..., **kwargs: Any
|
|
||||||
) -> Dict[Union[int, str], models.Model]: ...
|
|
||||||
def delete(self) -> Tuple[int, Dict[str, int]]: ...
|
def delete(self) -> Tuple[int, Dict[str, int]]: ...
|
||||||
def update(self, **kwargs: Any) -> int: ...
|
def update(self, **kwargs: Any) -> int: ...
|
||||||
def _update(self, values: Any) -> Optional[Any]: ...
|
def _update(self, values: Any) -> Optional[Any]: ...
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from contextlib import ContextDecorator
|
from typing import Any, Callable, Optional, overload, TypeVar
|
||||||
from typing import Any, Callable, Optional, Union, Iterator, overload, ContextManager
|
|
||||||
|
|
||||||
from django.db import ProgrammingError
|
from django.db import ProgrammingError
|
||||||
|
|
||||||
@@ -18,19 +17,23 @@ def get_rollback(using: None = ...) -> bool: ...
|
|||||||
def set_rollback(rollback: bool, using: Optional[str] = ...) -> None: ...
|
def set_rollback(rollback: bool, using: Optional[str] = ...) -> None: ...
|
||||||
def on_commit(func: Callable, using: None = ...) -> None: ...
|
def on_commit(func: Callable, using: None = ...) -> None: ...
|
||||||
|
|
||||||
class Atomic(ContextDecorator):
|
_C = TypeVar("_C", bound=Callable) # Any callable
|
||||||
|
|
||||||
|
# Don't inherit from ContextDecorator, so we can provide a more specific signature for __call__
|
||||||
|
class Atomic:
|
||||||
using: Optional[str] = ...
|
using: Optional[str] = ...
|
||||||
savepoint: bool = ...
|
savepoint: bool = ...
|
||||||
def __init__(self, using: Optional[str], savepoint: bool) -> None: ...
|
def __init__(self, using: Optional[str], savepoint: bool) -> None: ...
|
||||||
|
# When decorating, return the decorated function as-is, rather than clobbering it as ContextDecorator does.
|
||||||
|
def __call__(self, func: _C) -> _C: ...
|
||||||
def __enter__(self) -> None: ...
|
def __enter__(self) -> None: ...
|
||||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||||
|
|
||||||
|
# Bare decorator
|
||||||
@overload
|
@overload
|
||||||
def atomic() -> Atomic: ...
|
def atomic(using: _C) -> _C: ...
|
||||||
|
|
||||||
|
# Decorator or context-manager with parameters
|
||||||
@overload
|
@overload
|
||||||
def atomic(using: Optional[str] = ...,) -> ContextManager[Atomic]: ...
|
def atomic(using: Optional[str] = None, savepoint: bool = True) -> Atomic: ...
|
||||||
@overload
|
|
||||||
def atomic(using: Callable = ...) -> Callable: ...
|
|
||||||
@overload
|
|
||||||
def atomic(using: Optional[str] = ..., savepoint: bool = ...) -> ContextManager[Atomic]: ...
|
|
||||||
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import decimal
|
from datetime import datetime, timedelta
|
||||||
from datetime import date, datetime, time, timedelta
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Type
|
from typing import Any, Callable, List, Optional, Pattern, Sequence, Type, Union
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
from django.core.files.base import File
|
|
||||||
from django.core.validators import BaseValidator
|
from django.core.validators import BaseValidator
|
||||||
from django.db.models.fields.files import FieldFile
|
|
||||||
from django.forms.boundfield import BoundField
|
from django.forms.boundfield import BoundField
|
||||||
from django.forms.forms import BaseForm
|
from django.forms.forms import BaseForm
|
||||||
from django.forms.widgets import Widget
|
from django.forms.widgets import Widget
|
||||||
@@ -31,16 +27,16 @@ class Field:
|
|||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
required: bool = ...,
|
required: bool = ...,
|
||||||
widget: Optional[Any] = ...,
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
label: Optional[Any] = ...,
|
label: Optional[Any] = ...,
|
||||||
initial: Optional[Any] = ...,
|
initial: Optional[Any] = ...,
|
||||||
help_text: str = ...,
|
help_text: str = ...,
|
||||||
error_messages: Optional[Any] = ...,
|
error_messages: Optional[Any] = ...,
|
||||||
show_hidden_initial: bool = ...,
|
show_hidden_initial: bool = ...,
|
||||||
validators: Any = ...,
|
validators: Sequence[Any] = ...,
|
||||||
localize: bool = ...,
|
localize: bool = ...,
|
||||||
disabled: bool = ...,
|
disabled: bool = ...,
|
||||||
label_suffix: Optional[Any] = ...
|
label_suffix: Optional[Any] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def prepare_value(self, value: Any) -> Any: ...
|
def prepare_value(self, value: Any) -> Any: ...
|
||||||
def to_python(self, value: Optional[Any]) -> Optional[Any]: ...
|
def to_python(self, value: Optional[Any]) -> Optional[Any]: ...
|
||||||
@@ -49,60 +45,60 @@ class Field:
|
|||||||
def clean(self, value: Any) -> Any: ...
|
def clean(self, value: Any) -> Any: ...
|
||||||
def bound_data(self, data: Any, initial: Any) -> Any: ...
|
def bound_data(self, data: Any, initial: Any) -> Any: ...
|
||||||
def widget_attrs(self, widget: Widget) -> Any: ...
|
def widget_attrs(self, widget: Widget) -> Any: ...
|
||||||
def has_changed(self, initial: Any, data: Optional[str]) -> bool: ...
|
def has_changed(self, initial: Any, data: Any) -> bool: ...
|
||||||
def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ...
|
def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ...
|
||||||
def __deepcopy__(self, memo: Dict[Any, Any]) -> Field: ...
|
|
||||||
|
|
||||||
class CharField(Field):
|
class CharField(Field):
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
max_length: Optional[Union[int, str]] = ...
|
max_length: Optional[Union[int, str]] = ...
|
||||||
min_length: Optional[Union[int, str]] = ...
|
min_length: Optional[Union[int, str]] = ...
|
||||||
strip: bool = ...
|
strip: bool = ...
|
||||||
empty_value: Optional[str] = ...
|
empty_value: Optional[str] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
|
||||||
max_length: Optional[Any] = ...,
|
max_length: Optional[Any] = ...,
|
||||||
min_length: Optional[Any] = ...,
|
min_length: Optional[Any] = ...,
|
||||||
strip: bool = ...,
|
strip: bool = ...,
|
||||||
empty_value: str = ...,
|
empty_value: Optional[str] = ...,
|
||||||
**kwargs: Any
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
class IntegerField(Field):
|
class IntegerField(Field):
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
max_value: Optional[Any]
|
max_value: Optional[Any]
|
||||||
min_value: Optional[Any]
|
min_value: Optional[Any]
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
re_decimal: Any = ...
|
re_decimal: Any = ...
|
||||||
def __init__(self, *, max_value: Optional[Any] = ..., min_value: Optional[Any] = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
max_value: Optional[Any] = ...,
|
||||||
|
min_value: Optional[Any] = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class FloatField(IntegerField):
|
class FloatField(IntegerField):
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
max_value: Optional[float]
|
|
||||||
min_value: Optional[float]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def validate(self, value: Optional[float]) -> None: ...
|
def validate(self, value: Optional[float]) -> None: ...
|
||||||
|
|
||||||
class DecimalField(IntegerField):
|
class DecimalField(IntegerField):
|
||||||
decimal_places: Optional[int]
|
decimal_places: Optional[int]
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
max_digits: Optional[int]
|
max_digits: Optional[int]
|
||||||
max_value: Optional[Union[decimal.Decimal, int]]
|
|
||||||
min_value: Optional[Union[decimal.Decimal, int]]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
@@ -110,118 +106,95 @@ class DecimalField(IntegerField):
|
|||||||
min_value: Optional[Any] = ...,
|
min_value: Optional[Any] = ...,
|
||||||
max_digits: Optional[Any] = ...,
|
max_digits: Optional[Any] = ...,
|
||||||
decimal_places: Optional[Any] = ...,
|
decimal_places: Optional[Any] = ...,
|
||||||
**kwargs: Any
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def validate(self, value: Optional[Decimal]) -> None: ...
|
def validate(self, value: Optional[Decimal]) -> None: ...
|
||||||
|
|
||||||
class BaseTemporalField(Field):
|
class BaseTemporalField(Field):
|
||||||
input_formats: Any = ...
|
input_formats: Any = ...
|
||||||
def __init__(self, *, input_formats: Optional[Any] = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
def strptime(self, value: Any, format: Any) -> Any: ...
|
self,
|
||||||
|
input_formats: Optional[Any] = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
def strptime(self, value: Any, format: str) -> Any: ...
|
||||||
|
|
||||||
class DateField(BaseTemporalField):
|
class DateField(BaseTemporalField): ...
|
||||||
disabled: bool
|
class TimeField(BaseTemporalField): ...
|
||||||
error_messages: Dict[str, str]
|
class DateTimeField(BaseTemporalField): ...
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
input_formats: Any = ...
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def strptime(self, value: str, format: str) -> date: ...
|
|
||||||
|
|
||||||
class TimeField(BaseTemporalField):
|
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
input_formats: Any = ...
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def strptime(self, value: str, format: str) -> time: ...
|
|
||||||
|
|
||||||
class DateTimeField(BaseTemporalField):
|
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
input_formats: Any = ...
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def prepare_value(self, value: Optional[datetime]) -> Optional[datetime]: ...
|
|
||||||
def strptime(self, value: str, format: str) -> datetime: ...
|
|
||||||
|
|
||||||
class DurationField(Field):
|
class DurationField(Field):
|
||||||
disabled: bool
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def prepare_value(self, value: Optional[Union[timedelta, str]]) -> Optional[str]: ...
|
def prepare_value(self, value: Optional[Union[timedelta, str]]) -> Optional[str]: ...
|
||||||
|
|
||||||
class RegexField(CharField):
|
class RegexField(CharField):
|
||||||
disabled: bool
|
regex: str = ...
|
||||||
empty_value: str
|
def __init__(
|
||||||
error_messages: Dict[str, str]
|
self,
|
||||||
max_length: Optional[int]
|
regex: Union[str, Pattern],
|
||||||
min_length: Optional[int]
|
max_length: Optional[Any] = ...,
|
||||||
required: bool
|
min_length: Optional[Any] = ...,
|
||||||
show_hidden_initial: bool
|
strip: bool = ...,
|
||||||
strip: bool
|
empty_value: Optional[str] = ...,
|
||||||
def __init__(self, regex: str, **kwargs: Any) -> None: ...
|
required: bool = ...,
|
||||||
regex: Any = ...
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class EmailField(CharField):
|
class EmailField(CharField): ...
|
||||||
disabled: bool
|
|
||||||
empty_value: Optional[str]
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
max_length: Optional[int]
|
|
||||||
min_length: Optional[int]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
strip: bool
|
|
||||||
default_validators: Any = ...
|
|
||||||
def __init__(self, **kwargs: Any) -> None: ...
|
|
||||||
|
|
||||||
class FileField(Field):
|
class FileField(Field):
|
||||||
disabled: bool
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
max_length: Optional[int] = ...
|
max_length: Optional[int] = ...
|
||||||
allow_empty_file: bool = ...
|
allow_empty_file: bool = ...
|
||||||
def __init__(self, *, max_length: Optional[Any] = ..., allow_empty_file: bool = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
def bound_data(self, data: Any, initial: Optional[FieldFile]) -> Optional[Union[File, str]]: ...
|
self,
|
||||||
|
max_length: Optional[Any] = ...,
|
||||||
|
allow_empty_file: bool = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
def clean(self, data: Any, initial: Optional[Any] = ...): ...
|
||||||
|
|
||||||
class ImageField(FileField):
|
class ImageField(FileField): ...
|
||||||
allow_empty_file: bool
|
class URLField(CharField): ...
|
||||||
disabled: bool
|
class BooleanField(Field): ...
|
||||||
max_length: Optional[int]
|
class NullBooleanField(BooleanField): ...
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_validators: Any = ...
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
|
|
||||||
class URLField(CharField):
|
|
||||||
disabled: bool
|
|
||||||
empty_value: Optional[str]
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
max_length: Optional[int]
|
|
||||||
min_length: Optional[int]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
strip: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
default_validators: Any = ...
|
|
||||||
def __init__(self, **kwargs: Any) -> None: ...
|
|
||||||
|
|
||||||
class BooleanField(Field):
|
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
def validate(self, value: bool) -> None: ...
|
|
||||||
|
|
||||||
class NullBooleanField(BooleanField):
|
|
||||||
disabled: bool
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
def validate(self, value: Optional[bool]) -> None: ...
|
|
||||||
|
|
||||||
class CallableChoiceIterator:
|
class CallableChoiceIterator:
|
||||||
choices_func: Callable = ...
|
choices_func: Callable = ...
|
||||||
@@ -229,125 +202,191 @@ class CallableChoiceIterator:
|
|||||||
def __iter__(self) -> None: ...
|
def __iter__(self) -> None: ...
|
||||||
|
|
||||||
class ChoiceField(Field):
|
class ChoiceField(Field):
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
choices: Any = ...
|
choices: Any = ...
|
||||||
def __init__(self, *, choices: Any = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
def validate(self, value: Any) -> None: ...
|
self,
|
||||||
|
choices: Any = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
def valid_value(self, value: str) -> bool: ...
|
def valid_value(self, value: str) -> bool: ...
|
||||||
|
|
||||||
class TypedChoiceField(ChoiceField):
|
class TypedChoiceField(ChoiceField):
|
||||||
disabled: bool
|
coerce: Union[Callable, Type[Any]] = ...
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
coerce: Union[Callable, Type[Union[bool, float, str]]] = ...
|
|
||||||
empty_value: Optional[str] = ...
|
empty_value: Optional[str] = ...
|
||||||
def __init__(self, *, coerce: Any = ..., empty_value: str = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
coerce: Any = ...,
|
||||||
|
empty_value: Optional[str] = ...,
|
||||||
|
choices: Any = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class MultipleChoiceField(ChoiceField):
|
class MultipleChoiceField(ChoiceField): ...
|
||||||
disabled: bool
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
hidden_widget: Any = ...
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def validate(self, value: List[str]) -> None: ...
|
|
||||||
|
|
||||||
class TypedMultipleChoiceField(MultipleChoiceField):
|
class TypedMultipleChoiceField(MultipleChoiceField):
|
||||||
disabled: bool
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
coerce: Union[Callable, Type[float]] = ...
|
coerce: Union[Callable, Type[float]] = ...
|
||||||
empty_value: Optional[List[Any]] = ...
|
empty_value: Optional[List[Any]] = ...
|
||||||
def __init__(self, *, coerce: Any = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
def validate(self, value: List[str]) -> None: ...
|
self,
|
||||||
|
coerce: Any = ...,
|
||||||
|
empty_value: Optional[str] = ...,
|
||||||
|
choices: Any = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class ComboField(Field):
|
class ComboField(Field):
|
||||||
disabled: bool
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
fields: Any = ...
|
fields: Any = ...
|
||||||
def __init__(self, fields: List[CharField], **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
fields: Sequence[Field],
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class MultiValueField(Field):
|
class MultiValueField(Field):
|
||||||
disabled: bool
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
require_all_fields: bool = ...
|
require_all_fields: bool = ...
|
||||||
fields: Any = ...
|
fields: Any = ...
|
||||||
def __init__(self, fields: Tuple[Field, Field], *, require_all_fields: bool = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
def validate(self, value: Union[datetime, str]) -> None: ...
|
self,
|
||||||
|
fields: Sequence[Field],
|
||||||
|
require_all_fields: bool = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
def compress(self, data_list: Any) -> Any: ...
|
def compress(self, data_list: Any) -> Any: ...
|
||||||
|
|
||||||
class FilePathField(ChoiceField):
|
class FilePathField(ChoiceField):
|
||||||
allow_files: bool
|
allow_files: bool
|
||||||
allow_folders: bool
|
allow_folders: bool
|
||||||
disabled: bool
|
|
||||||
match: Optional[str]
|
match: Optional[str]
|
||||||
path: str
|
path: str
|
||||||
recursive: bool
|
recursive: bool
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
choices: Any = ...
|
|
||||||
match_re: Any = ...
|
match_re: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
path: str,
|
path: str,
|
||||||
*,
|
|
||||||
match: Optional[Any] = ...,
|
match: Optional[Any] = ...,
|
||||||
recursive: bool = ...,
|
recursive: bool = ...,
|
||||||
allow_files: bool = ...,
|
allow_files: bool = ...,
|
||||||
allow_folders: bool = ...,
|
allow_folders: bool = ...,
|
||||||
**kwargs: Any
|
choices: Any = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
class SplitDateTimeField(MultiValueField):
|
class SplitDateTimeField(MultiValueField):
|
||||||
disabled: bool
|
|
||||||
require_all_fields: bool
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
hidden_widget: Any = ...
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, *, input_date_formats: Optional[Any] = ..., input_time_formats: Optional[Any] = ..., **kwargs: Any
|
self,
|
||||||
|
input_date_formats: Optional[Any] = ...,
|
||||||
|
input_time_formats: Optional[Any] = ...,
|
||||||
|
fields: Sequence[Field] = ...,
|
||||||
|
require_all_fields: bool = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def compress(self, data_list: List[Optional[datetime]]) -> Optional[datetime]: ...
|
def compress(self, data_list: List[Optional[datetime]]) -> Optional[datetime]: ...
|
||||||
|
|
||||||
class GenericIPAddressField(CharField):
|
class GenericIPAddressField(CharField):
|
||||||
disabled: bool
|
|
||||||
empty_value: str
|
|
||||||
error_messages: Dict[str, str]
|
|
||||||
max_length: None
|
|
||||||
min_length: None
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
strip: bool
|
|
||||||
unpack_ipv4: bool = ...
|
unpack_ipv4: bool = ...
|
||||||
default_validators: List[Callable] = ...
|
def __init__(
|
||||||
def __init__(self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any) -> None: ...
|
self,
|
||||||
|
protocol: str = ...,
|
||||||
|
unpack_ipv4: bool = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class SlugField(CharField):
|
class SlugField(CharField):
|
||||||
disabled: bool
|
|
||||||
empty_value: str
|
|
||||||
max_length: Optional[int]
|
|
||||||
min_length: None
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
strip: bool
|
|
||||||
allow_unicode: bool = ...
|
allow_unicode: bool = ...
|
||||||
def __init__(self, *, allow_unicode: bool = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
allow_unicode: bool = ...,
|
||||||
|
required: bool = ...,
|
||||||
|
widget: Optional[Union[Widget, Type[Widget]]] = ...,
|
||||||
|
label: Optional[Any] = ...,
|
||||||
|
initial: Optional[Any] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
error_messages: Optional[Any] = ...,
|
||||||
|
show_hidden_initial: bool = ...,
|
||||||
|
validators: Sequence[Any] = ...,
|
||||||
|
localize: bool = ...,
|
||||||
|
disabled: bool = ...,
|
||||||
|
label_suffix: Optional[Any] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
class UUIDField(CharField):
|
class UUIDField(CharField): ...
|
||||||
disabled: bool
|
|
||||||
empty_value: str
|
|
||||||
max_length: None
|
|
||||||
min_length: None
|
|
||||||
required: bool
|
|
||||||
show_hidden_initial: bool
|
|
||||||
strip: bool
|
|
||||||
default_error_messages: Any = ...
|
|
||||||
def prepare_value(self, value: UUID) -> str: ...
|
|
||||||
|
|||||||
@@ -1,48 +1,46 @@
|
|||||||
from collections import OrderedDict
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Dict, Iterator, List, Mapping, Optional, Tuple, Type, Union
|
from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Type, Union
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError as ValidationError
|
from django.core.exceptions import ValidationError as ValidationError
|
||||||
from django.core.files.base import File
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.forms.boundfield import BoundField
|
from django.forms.boundfield import BoundField
|
||||||
from django.forms.fields import Field
|
from django.forms.fields import Field
|
||||||
|
from django.forms.renderers import BaseRenderer
|
||||||
from django.forms.utils import ErrorDict, ErrorList
|
from django.forms.utils import ErrorDict, ErrorList
|
||||||
from django.forms.widgets import Media, MediaDefiningClass
|
from django.forms.widgets import Media, MediaDefiningClass
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
class DeclarativeFieldsMetaclass(MediaDefiningClass):
|
class DeclarativeFieldsMetaclass(MediaDefiningClass):
|
||||||
def __new__(
|
def __new__(mcs, name: str, bases: Sequence[Type[BaseForm]], attrs: Dict[str, Any]) -> Type[BaseForm]: ...
|
||||||
mcs: Type[DeclarativeFieldsMetaclass], name: str, bases: Tuple[Type[BaseForm]], attrs: OrderedDict
|
|
||||||
) -> Type[BaseForm]: ...
|
|
||||||
|
|
||||||
class BaseForm:
|
class BaseForm:
|
||||||
default_renderer: Any = ...
|
default_renderer: Any = ...
|
||||||
field_order: Any = ...
|
field_order: Any = ...
|
||||||
prefix: Any = ...
|
|
||||||
use_required_attribute: bool = ...
|
use_required_attribute: bool = ...
|
||||||
is_bound: Any = ...
|
is_bound: bool = ...
|
||||||
data: Any = ...
|
data: Dict[str, Any] = ...
|
||||||
files: Any = ...
|
files: Optional[Dict[str, Any]] = ...
|
||||||
auto_id: Any = ...
|
auto_id: Any = ...
|
||||||
initial: Any = ...
|
initial: Dict[str, Any] = ...
|
||||||
error_class: Any = ...
|
error_class: Type[ErrorList] = ...
|
||||||
label_suffix: Any = ...
|
prefix: str = ...
|
||||||
empty_permitted: Any = ...
|
label_suffix: str = ...
|
||||||
fields: Any = ...
|
empty_permitted: bool = ...
|
||||||
renderer: Any = ...
|
fields: Dict[str, Any] = ...
|
||||||
|
renderer: BaseRenderer = ...
|
||||||
|
cleaned_data: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
data: Optional[Mapping[str, Any]] = ...,
|
data: Optional[Mapping[str, Any]] = ...,
|
||||||
files: Optional[Mapping[str, File]] = ...,
|
files: Optional[Mapping[str, Any]] = ...,
|
||||||
auto_id: Optional[Union[bool, str]] = ...,
|
auto_id: Optional[Union[bool, str]] = ...,
|
||||||
prefix: Optional[str] = ...,
|
prefix: Optional[str] = ...,
|
||||||
initial: Optional[Mapping[str, Any]] = ...,
|
initial: Optional[Mapping[str, Any]] = ...,
|
||||||
error_class: Type[ErrorList] = ...,
|
error_class: Type[ErrorList] = ...,
|
||||||
label_suffix: None = ...,
|
label_suffix: Optional[str] = ...,
|
||||||
empty_permitted: bool = ...,
|
empty_permitted: bool = ...,
|
||||||
field_order: None = ...,
|
field_order: Optional[Any] = ...,
|
||||||
use_required_attribute: Optional[bool] = ...,
|
use_required_attribute: Optional[bool] = ...,
|
||||||
renderer: Any = ...,
|
renderer: Any = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
@@ -60,7 +58,6 @@ class BaseForm:
|
|||||||
def non_field_errors(self) -> ErrorList: ...
|
def non_field_errors(self) -> ErrorList: ...
|
||||||
def add_error(self, field: Optional[str], error: Union[ValidationError, str]) -> None: ...
|
def add_error(self, field: Optional[str], error: Union[ValidationError, str]) -> None: ...
|
||||||
def has_error(self, field: Any, code: Optional[Any] = ...): ...
|
def has_error(self, field: Any, code: Optional[Any] = ...): ...
|
||||||
cleaned_data: Any = ...
|
|
||||||
def full_clean(self) -> None: ...
|
def full_clean(self) -> None: ...
|
||||||
def clean(self) -> Dict[str, Optional[Union[datetime, SimpleUploadedFile, QuerySet, str]]]: ...
|
def clean(self) -> Dict[str, Optional[Union[datetime, SimpleUploadedFile, QuerySet, str]]]: ...
|
||||||
def has_changed(self) -> bool: ...
|
def has_changed(self) -> bool: ...
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
import collections
|
from typing import Any, Dict, Mapping, Optional, Sequence, Sized
|
||||||
from typing import Any, List, Optional, Union, Dict, Type
|
|
||||||
|
|
||||||
from django.forms.renderers import BaseRenderer
|
|
||||||
from django.forms.utils import ErrorList
|
|
||||||
|
|
||||||
from django.forms import Form
|
from django.forms import Form
|
||||||
|
|
||||||
@@ -17,21 +13,9 @@ DEFAULT_MIN_NUM: int = ...
|
|||||||
DEFAULT_MAX_NUM: int = ...
|
DEFAULT_MAX_NUM: int = ...
|
||||||
|
|
||||||
class ManagementForm(Form):
|
class ManagementForm(Form):
|
||||||
auto_id: Union[bool, str]
|
|
||||||
cleaned_data: Dict[str, Optional[int]]
|
cleaned_data: Dict[str, Optional[int]]
|
||||||
data: Dict[str, Union[List[int], int, str]]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[str, int]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
prefix: str
|
|
||||||
renderer: BaseRenderer
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
||||||
|
|
||||||
class BaseFormSet:
|
class BaseFormSet(Sized, Mapping[str, Any]):
|
||||||
is_bound: Any = ...
|
is_bound: Any = ...
|
||||||
prefix: Any = ...
|
prefix: Any = ...
|
||||||
auto_id: Any = ...
|
auto_id: Any = ...
|
||||||
@@ -57,6 +41,7 @@ class BaseFormSet:
|
|||||||
def management_form(self): ...
|
def management_form(self): ...
|
||||||
def total_form_count(self): ...
|
def total_form_count(self): ...
|
||||||
def initial_form_count(self): ...
|
def initial_form_count(self): ...
|
||||||
|
@property
|
||||||
def forms(self): ...
|
def forms(self): ...
|
||||||
def get_form_kwargs(self, index: Any): ...
|
def get_form_kwargs(self, index: Any): ...
|
||||||
@property
|
@property
|
||||||
@@ -101,4 +86,4 @@ def formset_factory(
|
|||||||
min_num: Optional[Any] = ...,
|
min_num: Optional[Any] = ...,
|
||||||
validate_min: bool = ...,
|
validate_min: bool = ...,
|
||||||
): ...
|
): ...
|
||||||
def all_valid(formsets: List[Any]) -> bool: ...
|
def all_valid(formsets: Sequence[Any]) -> bool: ...
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, Sequence
|
from typing import Any, Callable, Dict, Iterator, List, MutableMapping, Optional, Sequence, Tuple, Type, Union, Mapping
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.base import File
|
||||||
|
from django.db import models
|
||||||
from django.db.models import ForeignKey
|
from django.db.models import ForeignKey
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.manager import Manager
|
from django.db.models.manager import Manager
|
||||||
@@ -14,25 +15,22 @@ from django.forms.fields import CharField, ChoiceField, Field
|
|||||||
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
|
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
|
||||||
from django.forms.formsets import BaseFormSet
|
from django.forms.formsets import BaseFormSet
|
||||||
from django.forms.utils import ErrorList
|
from django.forms.utils import ErrorList
|
||||||
from django.forms.widgets import Input, Widget, Select
|
from django.forms.widgets import Input, Widget
|
||||||
from django.http.request import QueryDict
|
from typing_extensions import Literal
|
||||||
from django.utils.datastructures import MultiValueDict
|
|
||||||
|
|
||||||
ALL_FIELDS: str
|
ALL_FIELDS: str
|
||||||
|
|
||||||
_Fields = Union[List[Union[Callable, str]], Tuple[str]]
|
_Fields = Union[List[Union[Callable, str]], Sequence[str], Literal["__all__"]]
|
||||||
_Labels = Dict[str, str]
|
_Labels = Dict[str, str]
|
||||||
_ErrorMessages = Dict[str, Dict[str, str]]
|
_ErrorMessages = Dict[str, Dict[str, str]]
|
||||||
|
|
||||||
def model_to_dict(
|
def model_to_dict(
|
||||||
instance: Model,
|
instance: Model, fields: Optional[_Fields] = ..., exclude: Optional[_Fields] = ...
|
||||||
fields: Optional[_Fields] = ...,
|
) -> Dict[str, Any]: ...
|
||||||
exclude: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ...,
|
|
||||||
) -> Dict[str, Optional[Union[bool, date, float]]]: ...
|
|
||||||
def fields_for_model(
|
def fields_for_model(
|
||||||
model: Type[Model],
|
model: Type[Model],
|
||||||
fields: Optional[_Fields] = ...,
|
fields: Optional[_Fields] = ...,
|
||||||
exclude: Optional[Union[List[Union[Callable, str]], Tuple]] = ...,
|
exclude: Optional[_Fields] = ...,
|
||||||
widgets: Optional[Union[Dict[str, Type[Input]], Dict[str, Widget]]] = ...,
|
widgets: Optional[Union[Dict[str, Type[Input]], Dict[str, Widget]]] = ...,
|
||||||
formfield_callback: Optional[Union[Callable, str]] = ...,
|
formfield_callback: Optional[Union[Callable, str]] = ...,
|
||||||
localized_fields: Optional[Union[Tuple[str], str]] = ...,
|
localized_fields: Optional[Union[Tuple[str], str]] = ...,
|
||||||
@@ -42,12 +40,12 @@ def fields_for_model(
|
|||||||
field_classes: Optional[Dict[str, Type[CharField]]] = ...,
|
field_classes: Optional[Dict[str, Type[CharField]]] = ...,
|
||||||
*,
|
*,
|
||||||
apply_limit_choices_to: bool = ...
|
apply_limit_choices_to: bool = ...
|
||||||
) -> OrderedDict: ...
|
) -> Dict[str, Any]: ...
|
||||||
|
|
||||||
class ModelFormOptions:
|
class ModelFormOptions:
|
||||||
model: Optional[Type[Model]] = ...
|
model: Optional[Type[Model]] = ...
|
||||||
fields: Optional[_Fields] = ...
|
fields: Optional[_Fields] = ...
|
||||||
exclude: Optional[Union[List[Union[Callable, str]], Tuple, str]] = ...
|
exclude: Optional[_Fields] = ...
|
||||||
widgets: Optional[Dict[str, Union[Widget, Input]]] = ...
|
widgets: Optional[Dict[str, Union[Widget, Input]]] = ...
|
||||||
localized_fields: Optional[Union[Tuple[str], str]] = ...
|
localized_fields: Optional[Union[Tuple[str], str]] = ...
|
||||||
labels: Optional[_Labels] = ...
|
labels: Optional[_Labels] = ...
|
||||||
@@ -57,46 +55,44 @@ class ModelFormOptions:
|
|||||||
def __init__(self, options: Optional[type] = ...) -> None: ...
|
def __init__(self, options: Optional[type] = ...) -> None: ...
|
||||||
|
|
||||||
class ModelFormMetaclass(DeclarativeFieldsMetaclass):
|
class ModelFormMetaclass(DeclarativeFieldsMetaclass):
|
||||||
def __new__(
|
def __new__(mcs, name: str, bases: Sequence[Type[Any]], attrs: Dict[str, Any]) -> Type[ModelForm]: ...
|
||||||
mcs: Type[ModelFormMetaclass], name: str, bases: Tuple[Type[ModelForm]], attrs: OrderedDict
|
|
||||||
) -> Type[ModelForm]: ...
|
|
||||||
|
|
||||||
class BaseModelForm(BaseForm):
|
class BaseModelForm(BaseForm):
|
||||||
instance: Any = ...
|
instance: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
data: Optional[Union[Dict[str, Any], QueryDict]] = ...,
|
data: Optional[Mapping[str, Any]] = ...,
|
||||||
files: Optional[Union[Dict[str, SimpleUploadedFile], MultiValueDict]] = ...,
|
files: Optional[Mapping[str, File]] = ...,
|
||||||
auto_id: Union[bool, str] = ...,
|
auto_id: Union[bool, str] = ...,
|
||||||
prefix: None = ...,
|
prefix: Optional[str] = ...,
|
||||||
initial: Optional[Union[Dict[str, List[int]], Dict[str, int]]] = ...,
|
initial: Optional[Dict[str, Any]] = ...,
|
||||||
error_class: Type[ErrorList] = ...,
|
error_class: Type[ErrorList] = ...,
|
||||||
label_suffix: None = ...,
|
label_suffix: Optional[str] = ...,
|
||||||
empty_permitted: bool = ...,
|
empty_permitted: bool = ...,
|
||||||
instance: Optional[Model] = ...,
|
instance: Optional[Model] = ...,
|
||||||
use_required_attribute: None = ...,
|
use_required_attribute: Optional[bool] = ...,
|
||||||
renderer: Any = ...,
|
renderer: Any = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def clean(self) -> Dict[str, Any]: ...
|
def clean(self) -> Dict[str, Any]: ...
|
||||||
def validate_unique(self) -> None: ...
|
def validate_unique(self) -> None: ...
|
||||||
save_m2m: Any = ...
|
save_m2m: Any = ...
|
||||||
def save(self, commit: bool = ...) -> Model: ...
|
def save(self, commit: bool = ...) -> Any: ...
|
||||||
|
|
||||||
class ModelForm(BaseModelForm): ...
|
class ModelForm(BaseModelForm): ...
|
||||||
|
|
||||||
def modelform_factory(
|
def modelform_factory(
|
||||||
model: Type[Model],
|
model: Type[Model],
|
||||||
form: Type[ModelForm] = ...,
|
form: Type[ModelForm] = ...,
|
||||||
fields: Optional[Union[List[str], str]] = ...,
|
fields: Optional[_Fields] = ...,
|
||||||
exclude: None = ...,
|
exclude: Optional[_Fields] = ...,
|
||||||
formfield_callback: Optional[str] = ...,
|
formfield_callback: Optional[Union[str, Callable[[models.Field], Field]]] = ...,
|
||||||
widgets: None = ...,
|
widgets: Optional[MutableMapping[str, Widget]] = ...,
|
||||||
localized_fields: None = ...,
|
localized_fields: Optional[Sequence[str]] = ...,
|
||||||
labels: None = ...,
|
labels: Optional[MutableMapping[str, str]] = ...,
|
||||||
help_texts: None = ...,
|
help_texts: Optional[MutableMapping[str, str]] = ...,
|
||||||
error_messages: None = ...,
|
error_messages: Optional[MutableMapping[str, Dict[str, Any]]] = ...,
|
||||||
field_classes: None = ...,
|
field_classes: Optional[MutableMapping[str, Type[Field]]] = ...,
|
||||||
) -> Any: ...
|
) -> Type[ModelForm]: ...
|
||||||
|
|
||||||
class BaseModelFormSet(BaseFormSet):
|
class BaseModelFormSet(BaseFormSet):
|
||||||
model: Any = ...
|
model: Any = ...
|
||||||
@@ -144,17 +140,17 @@ def modelformset_factory(
|
|||||||
can_order: bool = ...,
|
can_order: bool = ...,
|
||||||
min_num: Optional[int] = ...,
|
min_num: Optional[int] = ...,
|
||||||
max_num: Optional[int] = ...,
|
max_num: Optional[int] = ...,
|
||||||
fields: Optional[Union[str, Sequence[str]]] = ...,
|
fields: Optional[_Fields] = ...,
|
||||||
exclude: Optional[Sequence[str]] = ...,
|
exclude: Optional[_Fields] = ...,
|
||||||
widgets: Optional[Dict[str, Any]] = ...,
|
widgets: Optional[Dict[str, Any]] = ...,
|
||||||
validate_max: bool = ...,
|
validate_max: bool = ...,
|
||||||
localized_fields: None = ...,
|
localized_fields: Optional[Sequence[str]] = ...,
|
||||||
labels: Optional[Dict[str, str]] = ...,
|
labels: Optional[Dict[str, str]] = ...,
|
||||||
help_texts: Optional[Dict[str, str]] = ...,
|
help_texts: Optional[Dict[str, str]] = ...,
|
||||||
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
||||||
validate_min: bool = ...,
|
validate_min: bool = ...,
|
||||||
field_classes: Optional[Dict[str, Any]] = ...,
|
field_classes: Optional[Dict[str, Type[Field]]] = ...,
|
||||||
) -> Any: ...
|
) -> Type[BaseModelFormSet]: ...
|
||||||
|
|
||||||
class BaseInlineFormSet(BaseModelFormSet):
|
class BaseInlineFormSet(BaseModelFormSet):
|
||||||
instance: Any = ...
|
instance: Any = ...
|
||||||
@@ -183,8 +179,8 @@ def inlineformset_factory(
|
|||||||
form: Type[ModelForm] = ...,
|
form: Type[ModelForm] = ...,
|
||||||
formset: Type[BaseInlineFormSet] = ...,
|
formset: Type[BaseInlineFormSet] = ...,
|
||||||
fk_name: Optional[str] = ...,
|
fk_name: Optional[str] = ...,
|
||||||
fields: Optional[Union[str, Sequence[str]]] = ...,
|
fields: Optional[_Fields] = ...,
|
||||||
exclude: Optional[Sequence[str]] = ...,
|
exclude: Optional[_Fields] = ...,
|
||||||
extra: int = ...,
|
extra: int = ...,
|
||||||
can_order: bool = ...,
|
can_order: bool = ...,
|
||||||
can_delete: bool = ...,
|
can_delete: bool = ...,
|
||||||
@@ -192,14 +188,14 @@ def inlineformset_factory(
|
|||||||
formfield_callback: Optional[Callable] = ...,
|
formfield_callback: Optional[Callable] = ...,
|
||||||
widgets: Optional[Dict[str, Any]] = ...,
|
widgets: Optional[Dict[str, Any]] = ...,
|
||||||
validate_max: bool = ...,
|
validate_max: bool = ...,
|
||||||
localized_fields: None = ...,
|
localized_fields: Optional[Sequence[str]] = ...,
|
||||||
labels: Optional[Dict[str, str]] = ...,
|
labels: Optional[Dict[str, str]] = ...,
|
||||||
help_texts: Optional[Dict[str, str]] = ...,
|
help_texts: Optional[Dict[str, str]] = ...,
|
||||||
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
||||||
min_num: Optional[int] = ...,
|
min_num: Optional[int] = ...,
|
||||||
validate_min: bool = ...,
|
validate_min: bool = ...,
|
||||||
field_classes: Optional[Dict[str, Any]] = ...,
|
field_classes: Optional[Dict[str, Any]] = ...,
|
||||||
) -> Any: ...
|
) -> Type[BaseInlineFormSet]: ...
|
||||||
|
|
||||||
class InlineForeignKeyField(Field):
|
class InlineForeignKeyField(Field):
|
||||||
disabled: bool
|
disabled: bool
|
||||||
@@ -241,7 +237,7 @@ class ModelChoiceField(ChoiceField):
|
|||||||
self,
|
self,
|
||||||
queryset: Optional[Union[Manager, QuerySet]],
|
queryset: Optional[Union[Manager, QuerySet]],
|
||||||
*,
|
*,
|
||||||
empty_label: str = ...,
|
empty_label: Optional[str] = ...,
|
||||||
required: bool = ...,
|
required: bool = ...,
|
||||||
widget: Optional[Any] = ...,
|
widget: Optional[Any] = ...,
|
||||||
label: Optional[Any] = ...,
|
label: Optional[Any] = ...,
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
from collections import UserList
|
from collections import UserList
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, Sequence
|
from typing import Any, Dict, List, Optional, Sequence, Union
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
def pretty_name(name: str) -> str: ...
|
def pretty_name(name: str) -> str: ...
|
||||||
def flatatt(attrs: Dict[str, Optional[str]]) -> SafeText: ...
|
def flatatt(attrs: Dict[str, Any]) -> SafeText: ...
|
||||||
|
|
||||||
class ErrorDict(dict):
|
class ErrorDict(dict):
|
||||||
def as_data(self) -> Dict[str, List[ValidationError]]: ...
|
def as_data(self) -> Dict[str, List[ValidationError]]: ...
|
||||||
def get_json_data(self, escape_html: bool = ...) -> Dict[str, List[Dict[str, str]]]: ...
|
def get_json_data(self, escape_html: bool = ...) -> Dict[str, Any]: ...
|
||||||
def as_json(self, escape_html: bool = ...) -> str: ...
|
def as_json(self, escape_html: bool = ...) -> str: ...
|
||||||
def as_ul(self) -> str: ...
|
def as_ul(self) -> str: ...
|
||||||
def as_text(self) -> str: ...
|
def as_text(self) -> str: ...
|
||||||
@@ -19,16 +19,15 @@ class ErrorList(UserList):
|
|||||||
data: List[Union[ValidationError, str]]
|
data: List[Union[ValidationError, str]]
|
||||||
error_class: str = ...
|
error_class: str = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self, initlist: Optional[Union[ErrorList, Sequence[str]]] = ..., error_class: Optional[str] = ...
|
self,
|
||||||
|
initlist: Optional[Union[ErrorList, Sequence[Union[str, Exception]]]] = ...,
|
||||||
|
error_class: Optional[str] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def as_data(self) -> List[ValidationError]: ...
|
def as_data(self) -> List[ValidationError]: ...
|
||||||
def get_json_data(self, escape_html: bool = ...) -> List[Dict[str, str]]: ...
|
def get_json_data(self, escape_html: bool = ...) -> List[Dict[str, str]]: ...
|
||||||
def as_json(self, escape_html: bool = ...) -> str: ...
|
def as_json(self, escape_html: bool = ...) -> str: ...
|
||||||
def as_ul(self) -> str: ...
|
def as_ul(self) -> str: ...
|
||||||
def as_text(self) -> str: ...
|
def as_text(self) -> str: ...
|
||||||
def __reduce_ex__(
|
|
||||||
self, *args: Any, **kwargs: Any
|
|
||||||
) -> Tuple[Callable, Tuple[Type[ErrorList]], Dict[str, Union[List[ValidationError], str]], None, None]: ...
|
|
||||||
|
|
||||||
def from_current_timezone(value: datetime) -> datetime: ...
|
def from_current_timezone(value: datetime) -> datetime: ...
|
||||||
def to_current_timezone(value: datetime) -> datetime: ...
|
def to_current_timezone(value: datetime) -> datetime: ...
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
from datetime import time
|
from datetime import time
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, Iterable, Sequence
|
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union
|
||||||
|
|
||||||
from django.contrib.admin.options import BaseModelAdmin
|
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
||||||
from django.db.models.fields.files import FieldFile
|
from django.db.models.fields.files import FieldFile
|
||||||
from django.forms.forms import BaseForm
|
|
||||||
from django.forms.renderers import EngineMixin
|
from django.forms.renderers import EngineMixin
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
|
_OptAttrs = Dict[str, str]
|
||||||
|
|
||||||
class MediaOrderConflictWarning(RuntimeWarning): ...
|
class MediaOrderConflictWarning(RuntimeWarning): ...
|
||||||
|
|
||||||
class Media:
|
class Media:
|
||||||
@@ -32,9 +31,7 @@ class Media:
|
|||||||
def __add__(self, other: Media) -> Media: ...
|
def __add__(self, other: Media) -> Media: ...
|
||||||
|
|
||||||
class MediaDefiningClass(type):
|
class MediaDefiningClass(type):
|
||||||
def __new__(
|
def __new__(mcs, name: str, bases: Sequence[Any], attrs: Dict[str, Any]) -> type: ...
|
||||||
mcs: Type[MediaDefiningClass], name: str, bases: Tuple, attrs: Any
|
|
||||||
) -> Type[Union[BaseModelAdmin, BaseForm, Widget]]: ...
|
|
||||||
|
|
||||||
class Widget:
|
class Widget:
|
||||||
needs_multipart_form: bool = ...
|
needs_multipart_form: bool = ...
|
||||||
@@ -61,10 +58,10 @@ class Widget:
|
|||||||
self, base_attrs: Dict[str, Union[float, str]], extra_attrs: Optional[Dict[str, Union[bool, str]]] = ...
|
self, base_attrs: Dict[str, Union[float, str]], extra_attrs: Optional[Dict[str, Union[bool, str]]] = ...
|
||||||
) -> Dict[str, Union[Decimal, float, str]]: ...
|
) -> Dict[str, Union[Decimal, float, str]]: ...
|
||||||
def value_from_datadict(
|
def value_from_datadict(
|
||||||
self, data: dict, files: Union[Dict[str, SimpleUploadedFile], MultiValueDict], name: str
|
self, data: dict, files: Union[Dict[str, Iterable[Any]], MultiValueDict], name: str
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
def value_omitted_from_data(
|
def value_omitted_from_data(
|
||||||
self, data: Dict[str, Any], files: Union[Dict[str, SimpleUploadedFile], MultiValueDict], name: str
|
self, data: Dict[str, Any], files: Union[Dict[str, Iterable[Any]], MultiValueDict], name: str
|
||||||
) -> bool: ...
|
) -> bool: ...
|
||||||
def id_for_label(self, id_: str) -> str: ...
|
def id_for_label(self, id_: str) -> str: ...
|
||||||
def use_required_attribute(self, initial: Any) -> bool: ...
|
def use_required_attribute(self, initial: Any) -> bool: ...
|
||||||
@@ -80,6 +77,7 @@ class URLInput(Input): ...
|
|||||||
|
|
||||||
class PasswordInput(Input):
|
class PasswordInput(Input):
|
||||||
render_value: bool = ...
|
render_value: bool = ...
|
||||||
|
def __init__(self, attrs: Optional[_OptAttrs] = ..., render_value: bool = ...): ...
|
||||||
|
|
||||||
class HiddenInput(Input):
|
class HiddenInput(Input):
|
||||||
choices: Iterable[Tuple[str, str]]
|
choices: Iterable[Tuple[str, str]]
|
||||||
@@ -105,6 +103,7 @@ class DateTimeBaseInput(TextInput):
|
|||||||
format_key: str = ...
|
format_key: str = ...
|
||||||
supports_microseconds: bool = ...
|
supports_microseconds: bool = ...
|
||||||
format: Optional[str] = ...
|
format: Optional[str] = ...
|
||||||
|
def __init__(self, attrs: Optional[_OptAttrs] = ..., format: Optional[str] = ...): ...
|
||||||
|
|
||||||
class DateInput(DateTimeBaseInput): ...
|
class DateInput(DateTimeBaseInput): ...
|
||||||
class DateTimeInput(DateTimeBaseInput): ...
|
class DateTimeInput(DateTimeBaseInput): ...
|
||||||
@@ -112,9 +111,7 @@ class TimeInput(DateTimeBaseInput): ...
|
|||||||
|
|
||||||
class CheckboxInput(Input):
|
class CheckboxInput(Input):
|
||||||
check_test: Callable = ...
|
check_test: Callable = ...
|
||||||
def __init__(self, attrs: Optional[Dict[str, str]] = ..., check_test: Optional[Callable] = ...) -> None: ...
|
def __init__(self, attrs: Optional[_OptAttrs] = ..., check_test: Optional[Callable] = ...) -> None: ...
|
||||||
|
|
||||||
_OptAttrs = Dict[str, Any]
|
|
||||||
|
|
||||||
class ChoiceWidget(Widget):
|
class ChoiceWidget(Widget):
|
||||||
allow_multiple_selected: bool = ...
|
allow_multiple_selected: bool = ...
|
||||||
@@ -165,7 +162,7 @@ class CheckboxSelectMultiple(ChoiceWidget):
|
|||||||
class MultiWidget(Widget):
|
class MultiWidget(Widget):
|
||||||
template_name: str = ...
|
template_name: str = ...
|
||||||
widgets: List[Widget] = ...
|
widgets: List[Widget] = ...
|
||||||
def __init__(self, widgets: Sequence[Widget], attrs: Optional[_OptAttrs] = ...) -> None: ...
|
def __init__(self, widgets: Sequence[Union[Widget, Type[Widget]]], attrs: Optional[_OptAttrs] = ...) -> None: ...
|
||||||
@property
|
@property
|
||||||
def is_hidden(self) -> bool: ...
|
def is_hidden(self) -> bool: ...
|
||||||
def decompress(self, value: Any) -> Optional[Any]: ...
|
def decompress(self, value: Any) -> Optional[Any]: ...
|
||||||
@@ -209,7 +206,7 @@ class SelectDateWidget(Widget):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
attrs: Optional[_OptAttrs] = ...,
|
attrs: Optional[_OptAttrs] = ...,
|
||||||
years: Optional[Union[Tuple[Union[int, str]], range]] = ...,
|
years: Optional[Iterable[Union[int, str]]] = ...,
|
||||||
months: None = ...,
|
months: Optional[Dict[int, str]] = ...,
|
||||||
empty_label: Optional[Union[Tuple[str, str], str]] = ...,
|
empty_label: Optional[Union[str, Sequence[str]]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from io import BytesIO
|
from io import BytesIO, StringIO
|
||||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from django.http.request import QueryDict
|
from django.http.request import QueryDict
|
||||||
@@ -11,7 +11,7 @@ class MultiPartParser:
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
META: Dict[str, Any],
|
META: Dict[str, Any],
|
||||||
input_data: BytesIO,
|
input_data: Union[StringIO, BytesIO],
|
||||||
upload_handlers: Union[List[Any], ImmutableList],
|
upload_handlers: Union[List[Any], ImmutableList],
|
||||||
encoding: Optional[str] = ...,
|
encoding: Optional[str] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from json import JSONEncoder
|
from json import JSONEncoder
|
||||||
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, Union, overload, AnyStr, IO
|
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, Union, overload
|
||||||
|
|
||||||
import six
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.http.cookie import SimpleCookie
|
from django.http.cookie import SimpleCookie
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
@@ -13,7 +12,7 @@ from django.urls import ResolverMatch
|
|||||||
|
|
||||||
class BadHeaderError(ValueError): ...
|
class BadHeaderError(ValueError): ...
|
||||||
|
|
||||||
class HttpResponseBase(Iterable[AnyStr]):
|
class HttpResponseBase(Iterable[Any]):
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
cookies: SimpleCookie = ...
|
cookies: SimpleCookie = ...
|
||||||
reason_phrase: str = ...
|
reason_phrase: str = ...
|
||||||
@@ -27,13 +26,13 @@ class HttpResponseBase(Iterable[AnyStr]):
|
|||||||
charset: Optional[str] = ...,
|
charset: Optional[str] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def serialize_headers(self) -> bytes: ...
|
def serialize_headers(self) -> bytes: ...
|
||||||
def __setitem__(self, header: Union[str, bytes], value: Union[str, bytes]) -> None: ...
|
def __setitem__(self, header: Union[str, bytes], value: Union[str, bytes, int]) -> None: ...
|
||||||
def __delitem__(self, header: Union[str, bytes]) -> None: ...
|
def __delitem__(self, header: Union[str, bytes]) -> None: ...
|
||||||
def __getitem__(self, header: Union[str, bytes]) -> str: ...
|
def __getitem__(self, header: Union[str, bytes]) -> str: ...
|
||||||
def has_header(self, header: str) -> bool: ...
|
def has_header(self, header: str) -> bool: ...
|
||||||
def items(self) -> Iterable[Tuple[str, str]]: ...
|
def items(self) -> Iterable[Tuple[str, str]]: ...
|
||||||
@overload
|
@overload
|
||||||
def get(self, header: Union[str, bytes], alternate: str) -> str: ...
|
def get(self, header: Union[str, bytes], alternate: Optional[str]) -> str: ...
|
||||||
@overload
|
@overload
|
||||||
def get(self, header: Union[str, bytes]) -> Optional[str]: ...
|
def get(self, header: Union[str, bytes]) -> Optional[str]: ...
|
||||||
def set_cookie(
|
def set_cookie(
|
||||||
@@ -60,7 +59,7 @@ class HttpResponseBase(Iterable[AnyStr]):
|
|||||||
def seekable(self) -> bool: ...
|
def seekable(self) -> bool: ...
|
||||||
def writable(self) -> bool: ...
|
def writable(self) -> bool: ...
|
||||||
def writelines(self, lines: Iterable[object]): ...
|
def writelines(self, lines: Iterable[object]): ...
|
||||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
def __iter__(self) -> Iterator[Any]: ...
|
||||||
|
|
||||||
class HttpResponse(HttpResponseBase):
|
class HttpResponse(HttpResponseBase):
|
||||||
client: Client
|
client: Client
|
||||||
@@ -70,7 +69,6 @@ class HttpResponse(HttpResponseBase):
|
|||||||
request: Dict[str, Any]
|
request: Dict[str, Any]
|
||||||
resolver_match: ResolverMatch
|
resolver_match: ResolverMatch
|
||||||
sameorigin: bool
|
sameorigin: bool
|
||||||
status_code: int
|
|
||||||
templates: List[Template]
|
templates: List[Template]
|
||||||
test_server_port: str
|
test_server_port: str
|
||||||
test_was_secure_request: bool
|
test_was_secure_request: bool
|
||||||
@@ -88,21 +86,13 @@ class HttpResponse(HttpResponseBase):
|
|||||||
def json(self) -> Dict[str, Any]: ...
|
def json(self) -> Dict[str, Any]: ...
|
||||||
|
|
||||||
class StreamingHttpResponse(HttpResponseBase):
|
class StreamingHttpResponse(HttpResponseBase):
|
||||||
def __init__(self, streaming_content: Iterable[AnyStr] = ..., *args: Any, **kwargs: Any) -> None: ...
|
content: Any
|
||||||
@property
|
streaming_content: Iterator[Any]
|
||||||
def content(self) -> AnyStr: ...
|
def __init__(self, streaming_content: Iterable[Any] = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||||
@content.setter
|
def getvalue(self) -> Any: ...
|
||||||
def content(self, value: AnyStr) -> None: ...
|
|
||||||
@property
|
|
||||||
def streaming_content(self) -> Iterator[AnyStr]: ...
|
|
||||||
@streaming_content.setter
|
|
||||||
def streaming_content(self, value: Iterable[AnyStr]) -> None: ...
|
|
||||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
|
||||||
def getvalue(self) -> AnyStr: ...
|
|
||||||
|
|
||||||
class FileResponse(StreamingHttpResponse):
|
class FileResponse(StreamingHttpResponse):
|
||||||
client: Client
|
client: Client
|
||||||
closed: bool
|
|
||||||
context: None
|
context: None
|
||||||
file_to_stream: Optional[BytesIO]
|
file_to_stream: Optional[BytesIO]
|
||||||
request: Dict[str, str]
|
request: Dict[str, str]
|
||||||
@@ -119,8 +109,6 @@ class FileResponse(StreamingHttpResponse):
|
|||||||
class HttpResponseRedirectBase(HttpResponse):
|
class HttpResponseRedirectBase(HttpResponse):
|
||||||
allowed_schemes = ... # type: List[str]
|
allowed_schemes = ... # type: List[str]
|
||||||
def __init__(self, redirect_to: str, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, redirect_to: str, *args: Any, **kwargs: Any) -> None: ...
|
||||||
@property
|
|
||||||
def url(self) -> str: ...
|
|
||||||
|
|
||||||
class HttpResponseRedirect(HttpResponseRedirectBase): ...
|
class HttpResponseRedirect(HttpResponseRedirectBase): ...
|
||||||
class HttpResponsePermanentRedirect(HttpResponseRedirectBase): ...
|
class HttpResponsePermanentRedirect(HttpResponseRedirectBase): ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Optional, Union
|
from typing import Any, Optional, Union, Callable
|
||||||
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseBase
|
from django.http.response import HttpResponse, HttpResponseBase
|
||||||
@@ -26,4 +26,6 @@ class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware):
|
|||||||
cache_alias: str = ...
|
cache_alias: str = ...
|
||||||
cache_timeout: float = ...
|
cache_timeout: float = ...
|
||||||
cache: BaseCache = ...
|
cache: BaseCache = ...
|
||||||
def __init__(self, get_response: None = ..., cache_timeout: Optional[float] = ..., **kwargs: Any) -> None: ...
|
def __init__(
|
||||||
|
self, get_response: Optional[Callable] = ..., cache_timeout: Optional[float] = ..., **kwargs: Any
|
||||||
|
) -> None: ...
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseNotFound, HttpResponsePermanentRedirect
|
from django.http.response import HttpResponseBase, HttpResponsePermanentRedirect
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
class CommonMiddleware(MiddlewareMixin):
|
class CommonMiddleware(MiddlewareMixin):
|
||||||
@@ -9,9 +9,9 @@ class CommonMiddleware(MiddlewareMixin):
|
|||||||
def process_request(self, request: HttpRequest) -> Optional[HttpResponsePermanentRedirect]: ...
|
def process_request(self, request: HttpRequest) -> Optional[HttpResponsePermanentRedirect]: ...
|
||||||
def should_redirect_with_slash(self, request: HttpRequest) -> bool: ...
|
def should_redirect_with_slash(self, request: HttpRequest) -> bool: ...
|
||||||
def get_full_path_with_slash(self, request: HttpRequest) -> str: ...
|
def get_full_path_with_slash(self, request: HttpRequest) -> str: ...
|
||||||
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
||||||
|
|
||||||
class BrokenLinkEmailsMiddleware(MiddlewareMixin):
|
class BrokenLinkEmailsMiddleware(MiddlewareMixin):
|
||||||
def process_response(self, request: HttpRequest, response: HttpResponseNotFound) -> HttpResponseNotFound: ...
|
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
||||||
def is_internal_request(self, domain: str, referer: str) -> bool: ...
|
def is_internal_request(self, domain: str, referer: str) -> bool: ...
|
||||||
def is_ignorable_request(self, request: HttpRequest, uri: str, domain: str, referer: str) -> bool: ...
|
def is_ignorable_request(self, request: HttpRequest, uri: str, domain: str, referer: str) -> bool: ...
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseBase
|
from django.http.response import HttpResponseBase
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
re_accepts_gzip: Any
|
re_accepts_gzip: Any
|
||||||
|
|
||||||
class GZipMiddleware(MiddlewareMixin):
|
class GZipMiddleware(MiddlewareMixin):
|
||||||
def process_response(self, request: WSGIRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseBase
|
from django.http.response import HttpResponseBase
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
class ConditionalGetMiddleware(MiddlewareMixin):
|
class ConditionalGetMiddleware(MiddlewareMixin):
|
||||||
def process_response(self, request: WSGIRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
||||||
def needs_etag(self, response: HttpResponseBase) -> bool: ...
|
def needs_etag(self, response: HttpResponseBase) -> bool: ...
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseBase
|
from django.http.response import HttpResponseBase
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
class LocaleMiddleware(MiddlewareMixin):
|
class LocaleMiddleware(MiddlewareMixin):
|
||||||
response_redirect_class: Any = ...
|
response_redirect_class: Any = ...
|
||||||
def process_request(self, request: WSGIRequest) -> None: ...
|
def process_request(self, request: HttpRequest) -> None: ...
|
||||||
def process_response(self, request: WSGIRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import Any, Optional, List
|
from typing import Any, List, Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponsePermanentRedirect
|
from django.http.response import HttpResponse, HttpResponsePermanentRedirect
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
@@ -13,5 +13,5 @@ class SecurityMiddleware(MiddlewareMixin):
|
|||||||
redirect: bool = ...
|
redirect: bool = ...
|
||||||
redirect_host: Optional[str] = ...
|
redirect_host: Optional[str] = ...
|
||||||
redirect_exempt: List[Any] = ...
|
redirect_exempt: List[Any] = ...
|
||||||
def process_request(self, request: WSGIRequest) -> Optional[HttpResponsePermanentRedirect]: ...
|
def process_request(self, request: HttpRequest) -> Optional[HttpResponsePermanentRedirect]: ...
|
||||||
def process_response(self, request: WSGIRequest, response: HttpResponse) -> HttpResponse: ...
|
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Type, Union, Sequence, Protocol
|
from typing import Any, Callable, Dict, List, Optional, Protocol, Sequence, Type, TypeVar, Union
|
||||||
|
|
||||||
from django.db.models import Manager, QuerySet
|
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.http.response import HttpResponse as HttpResponse, HttpResponseRedirect as HttpResponseRedirect
|
from django.http.response import HttpResponse as HttpResponse, HttpResponseRedirect as HttpResponseRedirect
|
||||||
|
|
||||||
|
from django.db.models import Manager, QuerySet
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
|
|
||||||
def render_to_response(
|
def render_to_response(
|
||||||
@@ -28,6 +28,9 @@ class SupportsGetAbsoluteUrl(Protocol):
|
|||||||
def redirect(
|
def redirect(
|
||||||
to: Union[Callable, str, SupportsGetAbsoluteUrl], *args: Any, permanent: bool = ..., **kwargs: Any
|
to: Union[Callable, str, SupportsGetAbsoluteUrl], *args: Any, permanent: bool = ..., **kwargs: Any
|
||||||
) -> HttpResponseRedirect: ...
|
) -> HttpResponseRedirect: ...
|
||||||
def get_object_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> Model: ...
|
|
||||||
def get_list_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> List[Model]: ...
|
_T = TypeVar("_T", bound=Model)
|
||||||
|
|
||||||
|
def get_object_or_404(klass: Union[Type[_T], Manager[_T], QuerySet[_T]], *args: Any, **kwargs: Any) -> _T: ...
|
||||||
|
def get_list_or_404(klass: Union[Type[_T], Manager[_T], QuerySet[_T]], *args: Any, **kwargs: Any) -> List[_T]: ...
|
||||||
def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ...
|
def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ...
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class Template:
|
|||||||
nodelist: NodeList = ...
|
nodelist: NodeList = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
template_string: str,
|
template_string: Union[Template, str],
|
||||||
origin: Optional[Origin] = ...,
|
origin: Optional[Origin] = ...,
|
||||||
name: Optional[str] = ...,
|
name: Optional[str] = ...,
|
||||||
engine: Optional[Engine] = ...,
|
engine: Optional[Engine] = ...,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union
|
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union, Iterable
|
||||||
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.template.base import Node, Origin, Template
|
from django.template.base import Node, Origin, Template
|
||||||
@@ -15,10 +15,10 @@ class ContextDict(dict):
|
|||||||
def __enter__(self) -> ContextDict: ...
|
def __enter__(self) -> ContextDict: ...
|
||||||
def __exit__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __exit__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
|
|
||||||
class BaseContext:
|
class BaseContext(Iterable[Any]):
|
||||||
def __init__(self, dict_: Any = ...) -> None: ...
|
def __init__(self, dict_: Any = ...) -> None: ...
|
||||||
def __copy__(self) -> BaseContext: ...
|
def __copy__(self) -> BaseContext: ...
|
||||||
def __iter__(self) -> None: ...
|
def __iter__(self) -> Iterator[Any]: ...
|
||||||
def push(self, *args: Any, **kwargs: Any) -> ContextDict: ...
|
def push(self, *args: Any, **kwargs: Any) -> ContextDict: ...
|
||||||
def pop(self) -> ContextDict: ...
|
def pop(self) -> ContextDict: ...
|
||||||
def __setitem__(self, key: Union[Node, str], value: Any) -> None: ...
|
def __setitem__(self, key: Union[Node, str], value: Any) -> None: ...
|
||||||
@@ -50,7 +50,6 @@ class Context(BaseContext):
|
|||||||
class RenderContext(BaseContext):
|
class RenderContext(BaseContext):
|
||||||
dicts: List[Dict[Union[IncludeNode, str], str]]
|
dicts: List[Dict[Union[IncludeNode, str], str]]
|
||||||
template: Optional[Template] = ...
|
template: Optional[Template] = ...
|
||||||
def __iter__(self) -> None: ...
|
|
||||||
def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ...
|
def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ...
|
||||||
|
|
||||||
class RequestContext(Context):
|
class RequestContext(Context):
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ from django.http.cookie import SimpleCookie
|
|||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseBase
|
from django.http.response import HttpResponse, HttpResponseBase
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
|
||||||
|
|
||||||
BOUNDARY: str = ...
|
BOUNDARY: str = ...
|
||||||
MULTIPART_CONTENT: str = ...
|
MULTIPART_CONTENT: str = ...
|
||||||
CONTENT_TYPE_RE: Pattern = ...
|
CONTENT_TYPE_RE: Pattern = ...
|
||||||
@@ -42,13 +40,13 @@ class RequestFactory:
|
|||||||
cookies: SimpleCookie = ...
|
cookies: SimpleCookie = ...
|
||||||
errors: BytesIO = ...
|
errors: BytesIO = ...
|
||||||
def __init__(self, *, json_encoder: Any = ..., **defaults: Any) -> None: ...
|
def __init__(self, *, json_encoder: Any = ..., **defaults: Any) -> None: ...
|
||||||
def request(self, **request: Any) -> WSGIRequest: ...
|
def request(self, **request: Any) -> HttpRequest: ...
|
||||||
def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||||
def post(
|
def post(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||||
def trace(self, path: str, secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
def trace(self, path: str, secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||||
def options(
|
def options(
|
||||||
self,
|
self,
|
||||||
path: str,
|
path: str,
|
||||||
@@ -56,16 +54,16 @@ class RequestFactory:
|
|||||||
content_type: str = ...,
|
content_type: str = ...,
|
||||||
secure: bool = ...,
|
secure: bool = ...,
|
||||||
**extra: Any
|
**extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def put(
|
def put(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def patch(
|
def patch(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def delete(
|
def delete(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def generic(
|
def generic(
|
||||||
self,
|
self,
|
||||||
method: str,
|
method: str,
|
||||||
@@ -74,7 +72,7 @@ class RequestFactory:
|
|||||||
content_type: Optional[str] = ...,
|
content_type: Optional[str] = ...,
|
||||||
secure: bool = ...,
|
secure: bool = ...,
|
||||||
**extra: Any
|
**extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
|
|
||||||
class Client:
|
class Client:
|
||||||
json_encoder: Type[DjangoJSONEncoder] = ...
|
json_encoder: Type[DjangoJSONEncoder] = ...
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
from typing import Any, List, Optional, Tuple, Union, TypeVar, Iterable, Sequence
|
from typing import Any, List, Optional, Sequence, Tuple, TypeVar, Union
|
||||||
|
|
||||||
_Self = TypeVar("_Self")
|
_Self = TypeVar("_Self")
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,14 @@
|
|||||||
from typing import Any, Callable, Dict, List, Tuple, Type, Union
|
from typing import Any
|
||||||
|
|
||||||
from django.test import LiveServerTestCase
|
from django.test import LiveServerTestCase
|
||||||
|
|
||||||
class SeleniumTestCaseBase:
|
class SeleniumTestCaseBase:
|
||||||
browsers: Any = ...
|
browsers: Any = ...
|
||||||
browser: Any = ...
|
browser: Any = ...
|
||||||
def __new__(
|
|
||||||
cls: Type[SeleniumTestCaseBase],
|
|
||||||
name: str,
|
|
||||||
bases: Tuple[Type[SeleniumTestCase]],
|
|
||||||
attrs: Dict[str, Union[Callable, List[str], str]],
|
|
||||||
) -> Type[SeleniumTestCase]: ...
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_webdriver(cls, browser: Any): ...
|
def import_webdriver(cls, browser: Any): ...
|
||||||
def create_webdriver(self): ...
|
def create_webdriver(self): ...
|
||||||
|
|
||||||
class SeleniumTestCase(LiveServerTestCase):
|
class SeleniumTestCase(LiveServerTestCase):
|
||||||
implicit_wait: int = ...
|
implicit_wait: int = ...
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls) -> None: ...
|
|
||||||
def disable_implicit_wait(self) -> None: ...
|
def disable_implicit_wait(self) -> None: ...
|
||||||
|
|||||||
@@ -18,14 +18,9 @@ from django.utils.safestring import SafeText
|
|||||||
from django.db import connections as connections
|
from django.db import connections as connections
|
||||||
|
|
||||||
class _AssertNumQueriesContext(CaptureQueriesContext):
|
class _AssertNumQueriesContext(CaptureQueriesContext):
|
||||||
connection: Any
|
|
||||||
final_queries: Optional[int]
|
|
||||||
force_debug_cursor: bool
|
|
||||||
initial_queries: int
|
|
||||||
test_case: SimpleTestCase = ...
|
test_case: SimpleTestCase = ...
|
||||||
num: int = ...
|
num: int = ...
|
||||||
def __init__(self, test_case: Any, num: Any, connection: Any) -> None: ...
|
def __init__(self, test_case: Any, num: Any, connection: Any) -> None: ...
|
||||||
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ...
|
|
||||||
|
|
||||||
class _AssertTemplateUsedContext:
|
class _AssertTemplateUsedContext:
|
||||||
test_case: SimpleTestCase = ...
|
test_case: SimpleTestCase = ...
|
||||||
@@ -40,14 +35,7 @@ class _AssertTemplateUsedContext:
|
|||||||
def __enter__(self): ...
|
def __enter__(self): ...
|
||||||
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ...
|
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ...
|
||||||
|
|
||||||
class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext):
|
class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext): ...
|
||||||
context: ContextList
|
|
||||||
rendered_template_names: List[str]
|
|
||||||
rendered_templates: List[Template]
|
|
||||||
template_name: str
|
|
||||||
test_case: SimpleTestCase
|
|
||||||
def test(self): ...
|
|
||||||
def message(self): ...
|
|
||||||
|
|
||||||
class _CursorFailure:
|
class _CursorFailure:
|
||||||
cls_name: str = ...
|
cls_name: str = ...
|
||||||
@@ -59,10 +47,6 @@ class SimpleTestCase(unittest.TestCase):
|
|||||||
client_class: Any = ...
|
client_class: Any = ...
|
||||||
client: Client
|
client: Client
|
||||||
allow_database_queries: bool = ...
|
allow_database_queries: bool = ...
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls) -> None: ...
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls) -> None: ...
|
|
||||||
def __call__(self, result: unittest.TestResult = ...) -> None: ...
|
def __call__(self, result: unittest.TestResult = ...) -> None: ...
|
||||||
def settings(self, **kwargs: Any) -> Any: ...
|
def settings(self, **kwargs: Any) -> Any: ...
|
||||||
def modify_settings(self, **kwargs: Any) -> Any: ...
|
def modify_settings(self, **kwargs: Any) -> Any: ...
|
||||||
@@ -150,7 +134,6 @@ class TransactionTestCase(SimpleTestCase):
|
|||||||
fixtures: Any = ...
|
fixtures: Any = ...
|
||||||
multi_db: bool = ...
|
multi_db: bool = ...
|
||||||
serialized_rollback: bool = ...
|
serialized_rollback: bool = ...
|
||||||
allow_database_queries: bool = ...
|
|
||||||
def assertQuerysetEqual(
|
def assertQuerysetEqual(
|
||||||
self,
|
self,
|
||||||
qs: Union[Iterator[Any], List[Model], QuerySet, RawQuerySet],
|
qs: Union[Iterator[Any], List[Model], QuerySet, RawQuerySet],
|
||||||
@@ -164,10 +147,6 @@ class TransactionTestCase(SimpleTestCase):
|
|||||||
) -> Optional[_AssertNumQueriesContext]: ...
|
) -> Optional[_AssertNumQueriesContext]: ...
|
||||||
|
|
||||||
class TestCase(TransactionTestCase):
|
class TestCase(TransactionTestCase):
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls) -> None: ...
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls) -> None: ...
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls) -> None: ...
|
def setUpTestData(cls) -> None: ...
|
||||||
|
|
||||||
@@ -181,17 +160,14 @@ def skipIfDBFeature(*features: Any) -> Callable: ...
|
|||||||
def skipUnlessDBFeature(*features: Any) -> Callable: ...
|
def skipUnlessDBFeature(*features: Any) -> Callable: ...
|
||||||
def skipUnlessAnyDBFeature(*features: Any) -> Callable: ...
|
def skipUnlessAnyDBFeature(*features: Any) -> Callable: ...
|
||||||
|
|
||||||
class QuietWSGIRequestHandler(WSGIRequestHandler):
|
class QuietWSGIRequestHandler(WSGIRequestHandler): ...
|
||||||
def log_message(*args: Any) -> None: ...
|
|
||||||
|
|
||||||
class FSFilesHandler(WSGIHandler):
|
class FSFilesHandler(WSGIHandler):
|
||||||
application: Any = ...
|
application: Any = ...
|
||||||
base_url: Any = ...
|
base_url: Any = ...
|
||||||
def __init__(self, application: Any) -> None: ...
|
def __init__(self, application: Any) -> None: ...
|
||||||
def file_path(self, url: Any): ...
|
def file_path(self, url: Any): ...
|
||||||
def get_response(self, request: Any): ...
|
|
||||||
def serve(self, request: Any): ...
|
def serve(self, request: Any): ...
|
||||||
def __call__(self, environ: Any, start_response: Any): ...
|
|
||||||
|
|
||||||
class _StaticFilesHandler(FSFilesHandler):
|
class _StaticFilesHandler(FSFilesHandler):
|
||||||
def get_base_dir(self): ...
|
def get_base_dir(self): ...
|
||||||
@@ -216,7 +192,6 @@ class LiveServerThread(threading.Thread):
|
|||||||
port: int = ...,
|
port: int = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
httpd: ThreadedWSGIServer = ...
|
httpd: ThreadedWSGIServer = ...
|
||||||
def run(self) -> None: ...
|
|
||||||
def terminate(self) -> None: ...
|
def terminate(self) -> None: ...
|
||||||
|
|
||||||
class LiveServerTestCase(TransactionTestCase):
|
class LiveServerTestCase(TransactionTestCase):
|
||||||
@@ -225,10 +200,6 @@ class LiveServerTestCase(TransactionTestCase):
|
|||||||
server_thread_class: Any = ...
|
server_thread_class: Any = ...
|
||||||
static_handler: Any = ...
|
static_handler: Any = ...
|
||||||
def live_server_url(cls): ...
|
def live_server_url(cls): ...
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls) -> None: ...
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls) -> None: ...
|
|
||||||
|
|
||||||
class SerializeMixin:
|
class SerializeMixin:
|
||||||
lockfile: Any = ...
|
lockfile: Any = ...
|
||||||
|
|||||||
@@ -66,15 +66,15 @@ class override_system_checks(TestContextDecorator):
|
|||||||
|
|
||||||
class CaptureQueriesContext:
|
class CaptureQueriesContext:
|
||||||
connection: Any = ...
|
connection: Any = ...
|
||||||
|
force_debug_cursor: bool = ...
|
||||||
|
initial_queries: int = ...
|
||||||
|
final_queries: Optional[int] = ...
|
||||||
def __init__(self, connection: Any) -> None: ...
|
def __init__(self, connection: Any) -> None: ...
|
||||||
def __iter__(self): ...
|
def __iter__(self): ...
|
||||||
def __getitem__(self, index: int) -> Dict[str, str]: ...
|
def __getitem__(self, index: int) -> Dict[str, str]: ...
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
@property
|
@property
|
||||||
def captured_queries(self) -> List[Dict[str, str]]: ...
|
def captured_queries(self) -> List[Dict[str, str]]: ...
|
||||||
force_debug_cursor: bool = ...
|
|
||||||
initial_queries: int = ...
|
|
||||||
final_queries: Optional[int] = ...
|
|
||||||
def __enter__(self) -> CaptureQueriesContext: ...
|
def __enter__(self) -> CaptureQueriesContext: ...
|
||||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,11 @@ from typing import (
|
|||||||
Union,
|
Union,
|
||||||
overload,
|
overload,
|
||||||
Iterator,
|
Iterator,
|
||||||
|
Optional,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
_K = TypeVar("_K")
|
_K = TypeVar("_K")
|
||||||
_V = TypeVar("_V")
|
_V = TypeVar("_V")
|
||||||
|
|
||||||
@@ -27,24 +30,22 @@ class OrderedSet(MutableSet[_K]):
|
|||||||
|
|
||||||
class MultiValueDictKeyError(KeyError): ...
|
class MultiValueDictKeyError(KeyError): ...
|
||||||
|
|
||||||
_Val = Union[_V, List[_V]]
|
|
||||||
|
|
||||||
class MultiValueDict(MutableMapping[_K, _V]):
|
class MultiValueDict(MutableMapping[_K, _V]):
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, _Val]] = ...) -> None: ...
|
def __init__(self, key_to_list_mapping: Mapping[_K, Optional[List[_V]]] = ...) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, key_to_list_mapping: Mapping[_K, _Val] = ...) -> None: ...
|
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ...) -> None: ...
|
||||||
def getlist(self, key: _K, default: List[_V] = None) -> List[_V]: ...
|
def getlist(self, key: _K, default: List[_V] = None) -> List[_V]: ...
|
||||||
def setlist(self, key: _K, list_: List[_V]) -> None: ...
|
def setlist(self, key: _K, list_: List[_V]) -> None: ...
|
||||||
def setlistdefault(self, key: _K, default_list: List[_V] = None) -> List[_V]: ...
|
def setlistdefault(self, key: _K, default_list: List[_V] = None) -> List[_V]: ...
|
||||||
def appendlist(self, key: _K, value: _V) -> None: ...
|
def appendlist(self, key: _K, value: _V) -> None: ...
|
||||||
def lists(self) -> Iterable[Tuple[_K, List[_V]]]: ...
|
def lists(self) -> Iterable[Tuple[_K, List[_V]]]: ...
|
||||||
def dict(self) -> Dict[_K, _Val]: ...
|
def dict(self) -> Dict[_K, Union[_V, List[_V]]]: ...
|
||||||
def copy(self) -> MultiValueDict[_K, _V]: ...
|
def copy(self) -> MultiValueDict[_K, _V]: ...
|
||||||
# These overrides are needed to convince mypy that this isn't an abstract class
|
# These overrides are needed to convince mypy that this isn't an abstract class
|
||||||
def __delitem__(self, item: _K) -> None: ...
|
def __delitem__(self, item: _K) -> None: ...
|
||||||
def __getitem__(self, item: _K) -> _Val: ... # type: ignore
|
def __getitem__(self, item: _K) -> Union[_V, Literal[[]]]: ... # type: ignore
|
||||||
def __setitem__(self, k: _K, v: _Val) -> None: ...
|
def __setitem__(self, k: _K, v: Union[_V, List[_V]]) -> None: ...
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
def __iter__(self) -> Iterator[_K]: ...
|
def __iter__(self) -> Iterator[_K]: ...
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime, date, time
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, Iterator, List, Optional, Union
|
from typing import Any, Iterator, List, Optional, Union
|
||||||
|
|
||||||
@@ -8,14 +8,16 @@ FORMAT_SETTINGS: Any
|
|||||||
def reset_format_cache() -> None: ...
|
def reset_format_cache() -> None: ...
|
||||||
def iter_format_modules(lang: str, format_module_path: Optional[Union[List[str], str]] = ...) -> Iterator[Any]: ...
|
def iter_format_modules(lang: str, format_module_path: Optional[Union[List[str], str]] = ...) -> Iterator[Any]: ...
|
||||||
def get_format_modules(lang: Optional[str] = ..., reverse: bool = ...) -> List[Any]: ...
|
def get_format_modules(lang: Optional[str] = ..., reverse: bool = ...) -> List[Any]: ...
|
||||||
def get_format(
|
def get_format(format_type: str, lang: Optional[str] = ..., use_l10n: Optional[bool] = ...) -> str: ...
|
||||||
format_type: str, lang: Optional[str] = ..., use_l10n: Optional[bool] = ...
|
|
||||||
) -> Union[List[str], int, str]: ...
|
|
||||||
|
|
||||||
get_format_lazy: Any
|
get_format_lazy: Any
|
||||||
|
|
||||||
def date_format(value: Union[datetime, str], format: Optional[str] = ..., use_l10n: Optional[bool] = ...) -> str: ...
|
def date_format(
|
||||||
def time_format(value: Union[datetime, str], format: Optional[str] = ..., use_l10n: None = ...) -> str: ...
|
value: Union[date, datetime, str], format: Optional[str] = ..., use_l10n: Optional[bool] = ...
|
||||||
|
) -> str: ...
|
||||||
|
def time_format(
|
||||||
|
value: Union[time, datetime, str], format: Optional[str] = ..., use_l10n: Optional[bool] = ...
|
||||||
|
) -> str: ...
|
||||||
def number_format(
|
def number_format(
|
||||||
value: Union[Decimal, float, str],
|
value: Union[Decimal, float, str],
|
||||||
decimal_pos: Optional[int] = ...,
|
decimal_pos: Optional[int] = ...,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import logging.config
|
import logging.config
|
||||||
from typing import Any, Callable, Dict, Optional
|
from logging import LogRecord
|
||||||
|
from typing import Any, Callable, Dict, Optional, Union
|
||||||
|
|
||||||
from django.core.mail.backends.locmem import EmailBackend
|
from django.core.mail.backends.locmem import EmailBackend
|
||||||
from django.core.management.color import Style
|
from django.core.management.color import Style
|
||||||
@@ -20,9 +21,13 @@ class AdminEmailHandler(logging.Handler):
|
|||||||
class CallbackFilter(logging.Filter):
|
class CallbackFilter(logging.Filter):
|
||||||
callback: Callable = ...
|
callback: Callable = ...
|
||||||
def __init__(self, callback: Callable) -> None: ...
|
def __init__(self, callback: Callable) -> None: ...
|
||||||
|
def filter(self, record: Union[str, LogRecord]) -> bool: ...
|
||||||
|
|
||||||
class RequireDebugFalse(logging.Filter): ...
|
class RequireDebugFalse(logging.Filter):
|
||||||
class RequireDebugTrue(logging.Filter): ...
|
def filter(self, record: Union[str, LogRecord]) -> bool: ...
|
||||||
|
|
||||||
|
class RequireDebugTrue(logging.Filter):
|
||||||
|
def filter(self, record: Union[str, LogRecord]) -> bool: ...
|
||||||
|
|
||||||
class ServerFormatter(logging.Formatter):
|
class ServerFormatter(logging.Formatter):
|
||||||
datefmt: None
|
datefmt: None
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, Optional, Tuple, Union
|
from typing import Optional, Sequence, Union
|
||||||
|
|
||||||
def format(
|
def format(
|
||||||
number: Union[Decimal, float, str],
|
number: Union[Decimal, float, str],
|
||||||
decimal_sep: str,
|
decimal_sep: str,
|
||||||
decimal_pos: Optional[int] = ...,
|
decimal_pos: Optional[int] = ...,
|
||||||
grouping: Union[Tuple[int, int, int], int] = ...,
|
grouping: Union[int, Sequence[int]] = ...,
|
||||||
thousand_sep: str = ...,
|
thousand_sep: str = ...,
|
||||||
force_grouping: bool = ...,
|
force_grouping: bool = ...,
|
||||||
use_l10n: Optional[bool] = ...,
|
use_l10n: Optional[bool] = ...,
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
from django.views.generic.base import View
|
from .generic.base import View as View
|
||||||
|
|
||||||
__all__ = ["View"]
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
from typing import Any, Optional
|
|
||||||
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseForbidden
|
from django.http.response import HttpResponseForbidden
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter):
|
|||||||
class ExceptionReporter:
|
class ExceptionReporter:
|
||||||
request: Optional[HttpRequest] = ...
|
request: Optional[HttpRequest] = ...
|
||||||
filter: ExceptionReporterFilter = ...
|
filter: ExceptionReporterFilter = ...
|
||||||
exc_type: None = ...
|
exc_type: Optional[Type[BaseException]] = ...
|
||||||
exc_value: Optional[str] = ...
|
exc_value: Optional[str] = ...
|
||||||
tb: None = ...
|
tb: Optional[TracebackType] = ...
|
||||||
is_email: bool = ...
|
is_email: bool = ...
|
||||||
template_info: None = ...
|
template_info: None = ...
|
||||||
template_does_not_exist: bool = ...
|
template_does_not_exist: bool = ...
|
||||||
@@ -59,7 +59,7 @@ class ExceptionReporter:
|
|||||||
lineno: int,
|
lineno: int,
|
||||||
context_lines: int,
|
context_lines: int,
|
||||||
loader: Optional[SourceLoader] = ...,
|
loader: Optional[SourceLoader] = ...,
|
||||||
module_name: Optional[str] = None,
|
module_name: Optional[str] = ...,
|
||||||
): ...
|
): ...
|
||||||
|
|
||||||
def technical_404_response(request: HttpRequest, exception: Http404) -> HttpResponse: ...
|
def technical_404_response(request: HttpRequest, exception: Http404) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Callable
|
||||||
|
|
||||||
def xframe_options_deny(view_func: Callable) -> Callable: ...
|
def xframe_options_deny(view_func: Callable) -> Callable: ...
|
||||||
def xframe_options_sameorigin(view_func: Callable) -> Callable: ...
|
def xframe_options_sameorigin(view_func: Callable) -> Callable: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable
|
||||||
|
|
||||||
from django.middleware.csrf import CsrfViewMiddleware
|
from django.middleware.csrf import CsrfViewMiddleware
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable
|
||||||
|
|
||||||
def sensitive_variables(*variables: Any) -> Callable: ...
|
def sensitive_variables(*variables: Any) -> Callable: ...
|
||||||
def sensitive_post_parameters(*parameters: Any) -> Callable: ...
|
def sensitive_post_parameters(*parameters: Any) -> Callable: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable
|
||||||
|
|
||||||
def vary_on_headers(*headers: Any) -> Callable: ...
|
def vary_on_headers(*headers: Any) -> Callable: ...
|
||||||
def vary_on_cookie(func: Callable) -> Callable: ...
|
def vary_on_cookie(func: Callable) -> Callable: ...
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
from typing import Any, Optional
|
from typing import Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import (
|
from django.http.response import (
|
||||||
Http404,
|
|
||||||
HttpResponseBadRequest,
|
HttpResponseBadRequest,
|
||||||
HttpResponseForbidden,
|
HttpResponseForbidden,
|
||||||
HttpResponseNotFound,
|
HttpResponseNotFound,
|
||||||
@@ -15,10 +14,10 @@ ERROR_400_TEMPLATE_NAME: str
|
|||||||
ERROR_500_TEMPLATE_NAME: str
|
ERROR_500_TEMPLATE_NAME: str
|
||||||
|
|
||||||
def page_not_found(
|
def page_not_found(
|
||||||
request: WSGIRequest, exception: Optional[Http404], template_name: str = ...
|
request: HttpRequest, exception: Optional[Exception], template_name: str = ...
|
||||||
) -> HttpResponseNotFound: ...
|
) -> HttpResponseNotFound: ...
|
||||||
def server_error(request: WSGIRequest, template_name: str = ...) -> HttpResponseServerError: ...
|
def server_error(request: HttpRequest, template_name: str = ...) -> HttpResponseServerError: ...
|
||||||
def bad_request(request: WSGIRequest, exception: Exception, template_name: str = ...) -> HttpResponseBadRequest: ...
|
def bad_request(request: HttpRequest, exception: Exception, template_name: str = ...) -> HttpResponseBadRequest: ...
|
||||||
def permission_denied(
|
def permission_denied(
|
||||||
request: WSGIRequest, exception: Exception, template_name: str = ...
|
request: HttpRequest, exception: Exception, template_name: str = ...
|
||||||
) -> HttpResponseForbidden: ...
|
) -> HttpResponseForbidden: ...
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from django.views.generic.base import RedirectView as RedirectView, TemplateView as TemplateView, View as View
|
from .base import RedirectView as RedirectView, TemplateView as TemplateView, View as View
|
||||||
from django.views.generic.dates import (
|
from .dates import (
|
||||||
ArchiveIndexView as ArchiveIndexView,
|
ArchiveIndexView as ArchiveIndexView,
|
||||||
DateDetailView as DateDetailView,
|
DateDetailView as DateDetailView,
|
||||||
DayArchiveView as DayArchiveView,
|
DayArchiveView as DayArchiveView,
|
||||||
@@ -8,13 +8,8 @@ from django.views.generic.dates import (
|
|||||||
WeekArchiveView as WeekArchiveView,
|
WeekArchiveView as WeekArchiveView,
|
||||||
YearArchiveView as YearArchiveView,
|
YearArchiveView as YearArchiveView,
|
||||||
)
|
)
|
||||||
from django.views.generic.detail import DetailView as DetailView
|
from .detail import DetailView as DetailView
|
||||||
from django.views.generic.edit import (
|
from .edit import CreateView as CreateView, DeleteView as DeleteView, FormView as FormView, UpdateView as UpdateView
|
||||||
CreateView as CreateView,
|
from .list import ListView as ListView
|
||||||
DeleteView as DeleteView,
|
|
||||||
FormView as FormView,
|
|
||||||
UpdateView as UpdateView,
|
|
||||||
)
|
|
||||||
from django.views.generic.list import ListView as ListView
|
|
||||||
|
|
||||||
class GenericViewError(Exception): ...
|
class GenericViewError(Exception): ...
|
||||||
|
|||||||
@@ -1,48 +1,43 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type
|
from typing import Any, Callable, Dict, List, Optional, Type
|
||||||
|
|
||||||
from django import http
|
from django import http
|
||||||
|
|
||||||
logger = ... # type: Any
|
|
||||||
|
|
||||||
class ContextMixin:
|
class ContextMixin:
|
||||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
|
|
||||||
class View:
|
class View:
|
||||||
http_method_names = ... # type: List[str]
|
http_method_names: List[str] = ...
|
||||||
request = ... # type: http.HttpRequest
|
request: http.HttpRequest = ...
|
||||||
args = ... # type: Tuple[object, ...]
|
args: Any = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Any = ...
|
||||||
def __init__(self, **kwargs: object) -> None: ...
|
def __init__(self, **kwargs: Any) -> None: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def as_view(cls: Any, **initkwargs: object) -> Callable[..., http.HttpResponse]: ...
|
def as_view(cls: Any, **initkwargs: Any) -> Callable[..., http.HttpResponse]: ...
|
||||||
def dispatch(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def http_method_not_allowed(
|
def http_method_not_allowed(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
self, request: http.HttpRequest, *args: object, **kwargs: object
|
def options(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
) -> http.HttpResponse: ...
|
|
||||||
def options(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
|
||||||
|
|
||||||
class TemplateResponseMixin:
|
class TemplateResponseMixin:
|
||||||
template_name = ... # type: str
|
template_name: str = ...
|
||||||
template_engine = ... # type: Optional[str]
|
template_engine: Optional[str] = ...
|
||||||
response_class = ... # type: Type[http.HttpResponse]
|
response_class: Type[http.HttpResponse] = ...
|
||||||
content_type = ... # type: Optional[str]
|
content_type: Optional[str] = ...
|
||||||
request = ... # type: http.HttpRequest
|
request: http.HttpRequest = ...
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> http.HttpResponse: ...
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> http.HttpResponse: ...
|
||||||
def get_template_names(self) -> List[str]: ...
|
def get_template_names(self) -> List[str]: ...
|
||||||
|
|
||||||
class TemplateView(TemplateResponseMixin, ContextMixin, View):
|
class TemplateView(TemplateResponseMixin, ContextMixin, View):
|
||||||
def get(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def get(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
|
|
||||||
class RedirectView(View):
|
class RedirectView(View):
|
||||||
permanent = ... # type: bool
|
permanent: bool = ...
|
||||||
url = ... # type: Optional[str]
|
url: Optional[str] = ...
|
||||||
pattern_name = ... # type: Optional[str]
|
pattern_name: Optional[str] = ...
|
||||||
query_string = ... # type: bool
|
query_string: bool = ...
|
||||||
def get_redirect_url(self, *args: object, **kwargs: object) -> Optional[str]: ...
|
def get_redirect_url(self, *args: Any, **kwargs: Any) -> Optional[str]: ...
|
||||||
def get(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def get(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def head(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def head(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def post(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def post(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def options(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def delete(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def delete(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def put(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def put(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
def patch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ...
|
||||||
def patch(self, request: http.HttpRequest, *args: object, **kwargs: object) -> http.HttpResponse: ...
|
|
||||||
|
|||||||
@@ -8,49 +8,49 @@ from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResp
|
|||||||
from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin
|
from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin
|
||||||
|
|
||||||
class YearMixin:
|
class YearMixin:
|
||||||
year_format = ... # type: str
|
year_format: str = ...
|
||||||
year = ... # type: Optional[str]
|
year: Optional[str] = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
def get_year_format(self) -> str: ...
|
def get_year_format(self) -> str: ...
|
||||||
def get_year(self) -> str: ...
|
def get_year(self) -> str: ...
|
||||||
def get_next_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_year(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class MonthMixin:
|
class MonthMixin:
|
||||||
month_format = ... # type: str
|
month_format: str = ...
|
||||||
month = ... # type: Optional[str]
|
month: Optional[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_month_format(self) -> str: ...
|
def get_month_format(self) -> str: ...
|
||||||
def get_month(self) -> str: ...
|
def get_month(self) -> str: ...
|
||||||
def get_next_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_month(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class DayMixin:
|
class DayMixin:
|
||||||
day_format = ... # type: str
|
day_format: str = ...
|
||||||
day = ... # type: Optional[str]
|
day: Optional[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_day_format(self) -> str: ...
|
def get_day_format(self) -> str: ...
|
||||||
def get_day(self) -> str: ...
|
def get_day(self) -> str: ...
|
||||||
def get_next_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_day(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class WeekMixin:
|
class WeekMixin:
|
||||||
week_format = ... # type: str
|
week_format: str = ...
|
||||||
week = ... # type: Optional[str]
|
week: Optional[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_week_format(self) -> str: ...
|
def get_week_format(self) -> str: ...
|
||||||
def get_week(self) -> str: ...
|
def get_week(self) -> str: ...
|
||||||
def get_next_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_next_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
def get_previous_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
def get_previous_week(self, date: datetime.date) -> Optional[datetime.date]: ...
|
||||||
|
|
||||||
class DateMixin:
|
class DateMixin:
|
||||||
date_field = ... # type: Optional[str]
|
date_field: Optional[str] = ...
|
||||||
allow_future = ... # type: bool
|
allow_future: bool = ...
|
||||||
model = ... # type: Optional[Type[models.Model]]
|
model: Optional[Type[models.Model]] = ...
|
||||||
def get_date_field(self) -> str: ...
|
def get_date_field(self) -> str: ...
|
||||||
def get_allow_future(self) -> bool: ...
|
def get_allow_future(self) -> bool: ...
|
||||||
def uses_datetime_field(self) -> bool: ...
|
def uses_datetime_field(self) -> bool: ...
|
||||||
@@ -58,63 +58,33 @@ class DateMixin:
|
|||||||
DatedItems = Tuple[Optional[Sequence[datetime.date]], Sequence[object], Dict[str, Any]]
|
DatedItems = Tuple[Optional[Sequence[datetime.date]], Sequence[object], Dict[str, Any]]
|
||||||
|
|
||||||
class BaseDateListView(MultipleObjectMixin, DateMixin, View):
|
class BaseDateListView(MultipleObjectMixin, DateMixin, View):
|
||||||
allow_empty = ... # type: bool
|
date_list_period: str = ...
|
||||||
date_list_period = ... # type: str
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
def get_dated_items(self) -> DatedItems: ...
|
||||||
def get_ordering(self) -> Sequence[str]: ...
|
def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet: ...
|
||||||
def get_dated_queryset(self, **lookup: object) -> models.query.QuerySet: ...
|
|
||||||
def get_date_list_period(self) -> str: ...
|
def get_date_list_period(self) -> str: ...
|
||||||
def get_date_list(
|
def get_date_list(
|
||||||
self, queryset: models.query.QuerySet, date_type: str = None, ordering: str = ...
|
self, queryset: models.query.QuerySet, date_type: Optional[str] = ..., ordering: str = ...
|
||||||
) -> models.query.QuerySet: ...
|
) -> models.query.QuerySet: ...
|
||||||
|
|
||||||
class BaseArchiveIndexView(BaseDateListView):
|
class BaseArchiveIndexView(BaseDateListView): ...
|
||||||
context_object_name = ... # type: str
|
class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView): ...
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseYearArchiveView(YearMixin, BaseDateListView):
|
class BaseYearArchiveView(YearMixin, BaseDateListView):
|
||||||
date_list_period = ... # type: str
|
make_object_list: bool = ...
|
||||||
make_object_list = ... # type: bool
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
def get_make_object_list(self) -> bool: ...
|
def get_make_object_list(self) -> bool: ...
|
||||||
|
|
||||||
class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView):
|
class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView): ...
|
||||||
template_name_suffix = ... # type: str
|
class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView): ...
|
||||||
|
class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView): ...
|
||||||
class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView):
|
class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView): ...
|
||||||
date_list_period = ... # type: str
|
class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView): ...
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView): ...
|
||||||
|
class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView): ...
|
||||||
class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView):
|
class BaseTodayArchiveView(BaseDayArchiveView): ...
|
||||||
template_name_suffix = ... # type: str
|
class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView): ...
|
||||||
|
class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView): ...
|
||||||
class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView):
|
class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView): ...
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView):
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseTodayArchiveView(BaseDayArchiveView):
|
|
||||||
def get_dated_items(self) -> DatedItems: ...
|
|
||||||
|
|
||||||
class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView):
|
|
||||||
def get_object(self, queryset: models.query.QuerySet = None) -> models.Model: ...
|
|
||||||
|
|
||||||
class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
def timezone_today() -> datetime.date: ...
|
def timezone_today() -> datetime.date: ...
|
||||||
|
|||||||
@@ -1,35 +1,33 @@
|
|||||||
from typing import Any, Dict, List, Optional, Type
|
from typing import Any, Dict, Optional, Type
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.http import HttpResponse, HttpRequest
|
|
||||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
class SingleObjectMixin(ContextMixin):
|
class SingleObjectMixin(ContextMixin):
|
||||||
model = ... # type: Optional[Type[models.Model]]
|
model: Optional[Type[models.Model]] = ...
|
||||||
queryset = ... # type: Optional[models.query.QuerySet]
|
queryset: Optional[models.query.QuerySet] = ...
|
||||||
slug_field = ... # type: str
|
slug_field: str = ...
|
||||||
context_object_name = ... # type: Optional[str]
|
context_object_name: Optional[str] = ...
|
||||||
slug_url_kwarg = ... # type: str
|
slug_url_kwarg: str = ...
|
||||||
pk_url_kwarg = ... # type: str
|
pk_url_kwarg: str = ...
|
||||||
query_pk_and_slug = ... # type: bool
|
query_pk_and_slug: bool = ...
|
||||||
object = ... # type: models.Model
|
object: models.Model = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
def get_object(self, queryset: models.query.QuerySet = None) -> models.Model: ...
|
def get_object(self, queryset: Optional[models.query.QuerySet] = ...) -> models.Model: ...
|
||||||
def get_queryset(self) -> models.query.QuerySet: ...
|
def get_queryset(self) -> models.query.QuerySet: ...
|
||||||
def get_slug_field(self) -> str: ...
|
def get_slug_field(self) -> str: ...
|
||||||
def get_context_object_name(self, obj: Any) -> Optional[str]: ...
|
def get_context_object_name(self, obj: Any) -> Optional[str]: ...
|
||||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
|
||||||
|
|
||||||
class BaseDetailView(SingleObjectMixin, View):
|
class BaseDetailView(SingleObjectMixin, View):
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
object = ... # type: models.Model
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class SingleObjectTemplateResponseMixin(TemplateResponseMixin):
|
class SingleObjectTemplateResponseMixin(TemplateResponseMixin):
|
||||||
template_name_field = ... # type: Optional[str]
|
template_name_field: Optional[str] = ...
|
||||||
template_name_suffix = ... # type: str
|
template_name_suffix: str = ...
|
||||||
model = ... # type: Optional[Type[models.Model]]
|
model: Optional[Type[models.Model]] = ...
|
||||||
object = ... # type: models.Model
|
object: models.Model = ...
|
||||||
def get_template_names(self) -> List[str]: ...
|
|
||||||
|
|
||||||
class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView): ...
|
class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView): ...
|
||||||
|
|||||||
@@ -1,75 +1,53 @@
|
|||||||
from typing import Any, Dict, List, Optional, Type
|
from typing import Any, Callable, Dict, Optional, Sequence, Type, Union
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.forms import models as model_forms, Form # type: ignore # This will be solved when adding forms module
|
from django.forms.forms import BaseForm
|
||||||
from django.http import HttpResponse, HttpRequest
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||||
from django.views.generic.detail import BaseDetailView, SingleObjectMixin, SingleObjectTemplateResponseMixin
|
from django.views.generic.detail import BaseDetailView, SingleObjectMixin, SingleObjectTemplateResponseMixin
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
class FormMixin(ContextMixin):
|
class FormMixin(ContextMixin):
|
||||||
initial = ... # type: Dict[str, object]
|
initial: Dict[str, Any] = ...
|
||||||
form_class = ... # type: Optional[Type[Form]]
|
form_class: Optional[Type[BaseForm]] = ...
|
||||||
success_url = ... # type: Optional[str]
|
success_url: Optional[Union[str, Callable[..., Any]]] = ...
|
||||||
prefix = ... # type: Optional[str]
|
prefix: Optional[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: object) -> HttpResponse: ...
|
||||||
def get_initial(self) -> Dict[str, object]: ...
|
def get_initial(self) -> Dict[str, Any]: ...
|
||||||
def get_prefix(self) -> Optional[str]: ...
|
def get_prefix(self) -> Optional[str]: ...
|
||||||
def get_form_class(self) -> Type[Form]: ...
|
def get_form_class(self) -> Type[BaseForm]: ...
|
||||||
def get_form(self, form_class: Type[Form] = None) -> Form: ...
|
def get_form(self, form_class: Optional[Type[BaseForm]] = None) -> BaseForm: ...
|
||||||
def get_form_kwargs(self) -> Dict[str, Any]: ...
|
def get_form_kwargs(self) -> Dict[str, Any]: ...
|
||||||
def get_success_url(self) -> str: ...
|
def get_success_url(self) -> str: ...
|
||||||
def form_valid(self, form: Form) -> HttpResponse: ...
|
def form_valid(self, form: BaseForm) -> HttpResponse: ...
|
||||||
def form_invalid(self, form: Form) -> HttpResponse: ...
|
def form_invalid(self, form: BaseForm) -> HttpResponse: ...
|
||||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
|
||||||
|
|
||||||
class ModelFormMixin(FormMixin, SingleObjectMixin):
|
class ModelFormMixin(FormMixin, SingleObjectMixin):
|
||||||
fields = ... # type: Optional[List[str]]
|
fields: Optional[Union[Sequence[str], Literal["__all__"]]] = ...
|
||||||
object = ... # type: models.Model
|
|
||||||
def get_form_class(self) -> Type[Form]: ...
|
|
||||||
def get_form_kwargs(self) -> Dict[str, object]: ...
|
|
||||||
def get_success_url(self) -> str: ...
|
|
||||||
def form_valid(self, form: Form) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class ProcessFormView(View):
|
class ProcessFormView(View):
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
def get_form(self, form_class: Type[Form] = None) -> Form: ...
|
def get(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ...
|
||||||
def form_valid(self, form: Form) -> HttpResponse: ...
|
def post(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ...
|
||||||
def form_invalid(self, form: Form) -> HttpResponse: ...
|
def put(self, *args: str, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
def post(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
def put(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class BaseFormView(FormMixin, ProcessFormView): ...
|
class BaseFormView(FormMixin, ProcessFormView): ...
|
||||||
class FormView(TemplateResponseMixin, BaseFormView): ...
|
class FormView(TemplateResponseMixin, BaseFormView): ...
|
||||||
|
class BaseCreateView(ModelFormMixin, ProcessFormView): ...
|
||||||
class BaseCreateView(ModelFormMixin, ProcessFormView):
|
class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView): ...
|
||||||
object = ... # type: models.Model
|
class BaseUpdateView(ModelFormMixin, ProcessFormView): ...
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView): ...
|
||||||
def post(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
class BaseUpdateView(ModelFormMixin, ProcessFormView):
|
|
||||||
object = ... # type: models.Model
|
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
def post(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|
||||||
_object = object
|
_object = object
|
||||||
|
|
||||||
class DeletionMixin:
|
class DeletionMixin:
|
||||||
success_url = ... # type: Optional[str]
|
success_url: Optional[str] = ...
|
||||||
object = ... # type: models.Model
|
object: models.Model = ...
|
||||||
def delete(self, request: HttpRequest, *args: _object, **kwargs: _object) -> HttpResponse: ...
|
def post(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ...
|
||||||
def post(self, request: HttpRequest, *args: _object, **kwargs: _object) -> HttpResponse: ...
|
def delete(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get_success_url(self) -> str: ...
|
def get_success_url(self) -> str: ...
|
||||||
|
|
||||||
class BaseDeleteView(DeletionMixin, BaseDetailView): ...
|
class BaseDeleteView(DeletionMixin, BaseDetailView): ...
|
||||||
|
class DeleteView(SingleObjectTemplateResponseMixin, BaseDeleteView): ...
|
||||||
class DeleteView(SingleObjectTemplateResponseMixin, BaseDeleteView):
|
|
||||||
template_name_suffix = ... # type: str
|
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type
|
from typing import Any, Dict, Optional, Sequence, Tuple, Type
|
||||||
|
|
||||||
from django.db.models import Model
|
from django.core.paginator import Paginator
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.core.paginator import Paginator # type: ignore # This will be fixed when adding the paginator module
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
|
||||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||||
|
|
||||||
|
from django.db.models import Model
|
||||||
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
class MultipleObjectMixin(ContextMixin):
|
class MultipleObjectMixin(ContextMixin):
|
||||||
allow_empty = ... # type: bool
|
allow_empty: bool = ...
|
||||||
queryset = ... # type: Optional[QuerySet]
|
queryset: Optional[QuerySet] = ...
|
||||||
model = ... # type: Optional[Type[Model]]
|
model: Optional[Type[Model]] = ...
|
||||||
paginate_by = ... # type: Optional[int]
|
paginate_by: Optional[int] = ...
|
||||||
paginate_orphans = ... # type: int
|
paginate_orphans: int = ...
|
||||||
context_object_name = ... # type: Optional[str]
|
context_object_name: Optional[str] = ...
|
||||||
paginator_class = ... # type: Type[Paginator]
|
paginator_class: Type[Paginator] = ...
|
||||||
page_kwarg = ... # type: str
|
page_kwarg: str = ...
|
||||||
ordering = ... # type: Sequence[str]
|
ordering: Sequence[str] = ...
|
||||||
request = ... # type: HttpRequest
|
request: HttpRequest = ...
|
||||||
kwargs = ... # type: Dict[str, object]
|
kwargs: Dict[str, Any] = ...
|
||||||
object_list = ... # type: QuerySet
|
object_list: QuerySet = ...
|
||||||
def get_queryset(self) -> QuerySet: ...
|
def get_queryset(self) -> QuerySet: ...
|
||||||
def get_ordering(self) -> Sequence[str]: ...
|
def get_ordering(self) -> Sequence[str]: ...
|
||||||
def paginate_queryset(self, queryset: QuerySet, page_size: int) -> Tuple[Paginator, int, QuerySet, bool]: ...
|
def paginate_queryset(self, queryset: QuerySet, page_size: int) -> Tuple[Paginator, int, QuerySet, bool]: ...
|
||||||
@@ -29,16 +30,13 @@ class MultipleObjectMixin(ContextMixin):
|
|||||||
def get_paginate_orphans(self) -> int: ...
|
def get_paginate_orphans(self) -> int: ...
|
||||||
def get_allow_empty(self) -> bool: ...
|
def get_allow_empty(self) -> bool: ...
|
||||||
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
||||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
|
||||||
|
|
||||||
class BaseListView(MultipleObjectMixin, View):
|
class BaseListView(MultipleObjectMixin, View):
|
||||||
object_list = ... # type: QuerySet
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get(self, request: HttpRequest, *args: object, **kwargs: object) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
|
class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
|
||||||
template_name_suffix = ... # type: str
|
template_name_suffix: str = ...
|
||||||
object_list = ... # type: QuerySet
|
object_list: QuerySet = ...
|
||||||
def get_template_names(self) -> List[str]: ...
|
|
||||||
|
|
||||||
class ListView(MultipleObjectTemplateResponseMixin, BaseListView): ...
|
class ListView(MultipleObjectTemplateResponseMixin, BaseListView): ...
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Callable, Dict, List, Optional, Union
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
|
from django.utils.translation.trans_real import DjangoTranslation
|
||||||
|
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
|
|
||||||
LANGUAGE_QUERY_PARAMETER: str
|
LANGUAGE_QUERY_PARAMETER: str
|
||||||
|
|
||||||
def set_language(request: WSGIRequest) -> HttpResponse: ...
|
def set_language(request: HttpRequest) -> HttpResponse: ...
|
||||||
def get_formats() -> Dict[str, Union[List[str], int, str]]: ...
|
def get_formats() -> Dict[str, Union[List[str], int, str]]: ...
|
||||||
|
|
||||||
js_catalog_template: str
|
js_catalog_template: str
|
||||||
@@ -15,21 +17,15 @@ def render_javascript_catalog(catalog: Optional[Any] = ..., plural: Optional[Any
|
|||||||
def null_javascript_catalog(request: Any, domain: Optional[Any] = ..., packages: Optional[Any] = ...): ...
|
def null_javascript_catalog(request: Any, domain: Optional[Any] = ..., packages: Optional[Any] = ...): ...
|
||||||
|
|
||||||
class JavaScriptCatalog(View):
|
class JavaScriptCatalog(View):
|
||||||
args: Tuple
|
|
||||||
head: Callable
|
head: Callable
|
||||||
kwargs: Dict[Any, Any]
|
|
||||||
request: WSGIRequest
|
|
||||||
domain: str = ...
|
domain: str = ...
|
||||||
packages: List[str] = ...
|
packages: List[str] = ...
|
||||||
translation: django.utils.translation.trans_real.DjangoTranslation = ...
|
translation: DjangoTranslation = ...
|
||||||
def get(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
def get_paths(self, packages: List[str]) -> List[str]: ...
|
def get_paths(self, packages: List[str]) -> List[str]: ...
|
||||||
def get_plural(self) -> None: ...
|
def get_plural(self) -> None: ...
|
||||||
def get_catalog(self) -> Dict[str, Union[List[str], str]]: ...
|
def get_catalog(self) -> Dict[str, Union[List[str], str]]: ...
|
||||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Optional[Dict[str, Union[List[str], int, str]]]]: ...
|
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||||
def render_to_response(
|
def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ...
|
||||||
self, context: Dict[str, Optional[Dict[str, Union[List[str], int, str]]]], **response_kwargs: Any
|
|
||||||
) -> HttpResponse: ...
|
|
||||||
|
|
||||||
class JSONCatalog(JavaScriptCatalog):
|
class JSONCatalog(JavaScriptCatalog): ...
|
||||||
def render_to_response(self, context: Any, **response_kwargs: Any): ...
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import FileResponse
|
from django.http.response import FileResponse
|
||||||
|
|
||||||
def serve(request: WSGIRequest, path: str, document_root: str = ..., show_indexes: bool = ...) -> FileResponse: ...
|
def serve(request: HttpRequest, path: str, document_root: str = ..., show_indexes: bool = ...) -> FileResponse: ...
|
||||||
|
|
||||||
DEFAULT_DIRECTORY_INDEX_TEMPLATE: str
|
DEFAULT_DIRECTORY_INDEX_TEMPLATE: str
|
||||||
template_translatable: Any
|
template_translatable: Any
|
||||||
|
|||||||
@@ -10,12 +10,17 @@ class Config:
|
|||||||
ignore_missing_settings: bool = False
|
ignore_missing_settings: bool = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_config_file(self, fpath: str) -> 'Config':
|
def from_config_file(cls, fpath: str) -> 'Config':
|
||||||
ini_config = ConfigParser()
|
ini_config = ConfigParser()
|
||||||
ini_config.read(fpath)
|
ini_config.read(fpath)
|
||||||
if not ini_config.has_section('mypy_django_plugin'):
|
if not ini_config.has_section('mypy_django_plugin'):
|
||||||
raise ValueError('Invalid config file: no [mypy_django_plugin] section')
|
raise ValueError('Invalid config file: no [mypy_django_plugin] section')
|
||||||
return Config(django_settings_module=ini_config.get('mypy_django_plugin', 'django_settings',
|
|
||||||
fallback=None),
|
django_settings = ini_config.get('mypy_django_plugin', 'django_settings',
|
||||||
ignore_missing_settings=ini_config.get('mypy_django_plugin', 'ignore_missing_settings',
|
fallback=None)
|
||||||
fallback=False))
|
if django_settings:
|
||||||
|
django_settings = django_settings.strip()
|
||||||
|
|
||||||
|
return Config(django_settings_module=django_settings,
|
||||||
|
ignore_missing_settings=bool(ini_config.get('mypy_django_plugin', 'ignore_missing_settings',
|
||||||
|
fallback=False)))
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
import typing
|
import typing
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
from mypy.nodes import Expression, ImportedName, MypyFile, NameExpr, SymbolNode, TypeInfo
|
from mypy.checker import TypeChecker
|
||||||
from mypy.plugin import FunctionContext
|
from mypy.nodes import (
|
||||||
from mypy.types import AnyType, Instance, Type, TypeOfAny, TypeVarType
|
AssignmentStmt, ClassDef, Expression, ImportedName, Lvalue, MypyFile, NameExpr, SymbolNode, TypeInfo,
|
||||||
|
)
|
||||||
|
from mypy.plugin import FunctionContext, MethodContext
|
||||||
|
from mypy.types import (
|
||||||
|
AnyType, Instance, NoneTyp, Type, TypeOfAny, TypeVarType, UnionType,
|
||||||
|
)
|
||||||
|
|
||||||
MODEL_CLASS_FULLNAME = 'django.db.models.base.Model'
|
MODEL_CLASS_FULLNAME = 'django.db.models.base.Model'
|
||||||
FIELD_FULLNAME = 'django.db.models.fields.Field'
|
FIELD_FULLNAME = 'django.db.models.fields.Field'
|
||||||
|
CHAR_FIELD_FULLNAME = 'django.db.models.fields.CharField'
|
||||||
|
ARRAY_FIELD_FULLNAME = 'django.contrib.postgres.fields.array.ArrayField'
|
||||||
|
AUTO_FIELD_FULLNAME = 'django.db.models.fields.AutoField'
|
||||||
GENERIC_FOREIGN_KEY_FULLNAME = 'django.contrib.contenttypes.fields.GenericForeignKey'
|
GENERIC_FOREIGN_KEY_FULLNAME = 'django.contrib.contenttypes.fields.GenericForeignKey'
|
||||||
FOREIGN_KEY_FULLNAME = 'django.db.models.fields.related.ForeignKey'
|
FOREIGN_KEY_FULLNAME = 'django.db.models.fields.related.ForeignKey'
|
||||||
ONETOONE_FIELD_FULLNAME = 'django.db.models.fields.related.OneToOneField'
|
ONETOONE_FIELD_FULLNAME = 'django.db.models.fields.related.OneToOneField'
|
||||||
@@ -18,6 +26,12 @@ BASE_MANAGER_CLASS_FULLNAME = 'django.db.models.manager.BaseManager'
|
|||||||
MANAGER_CLASS_FULLNAME = 'django.db.models.manager.Manager'
|
MANAGER_CLASS_FULLNAME = 'django.db.models.manager.Manager'
|
||||||
RELATED_MANAGER_CLASS_FULLNAME = 'django.db.models.manager.RelatedManager'
|
RELATED_MANAGER_CLASS_FULLNAME = 'django.db.models.manager.RelatedManager'
|
||||||
|
|
||||||
|
BASEFORM_CLASS_FULLNAME = 'django.forms.forms.BaseForm'
|
||||||
|
FORM_CLASS_FULLNAME = 'django.forms.forms.Form'
|
||||||
|
MODELFORM_CLASS_FULLNAME = 'django.forms.models.ModelForm'
|
||||||
|
|
||||||
|
FORM_MIXIN_CLASS_FULLNAME = 'django.views.generic.edit.FormMixin'
|
||||||
|
|
||||||
MANAGER_CLASSES = {
|
MANAGER_CLASSES = {
|
||||||
MANAGER_CLASS_FULLNAME,
|
MANAGER_CLASS_FULLNAME,
|
||||||
RELATED_MANAGER_CLASS_FULLNAME,
|
RELATED_MANAGER_CLASS_FULLNAME,
|
||||||
@@ -49,9 +63,9 @@ def get_model_fullname(app_name: str, model_name: str,
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class InvalidModelString(ValueError):
|
class SameFileModel(Exception):
|
||||||
def __init__(self, model_string: str):
|
def __init__(self, model_cls_name: str):
|
||||||
self.model_string = model_string
|
self.model_cls_name = model_cls_name
|
||||||
|
|
||||||
|
|
||||||
class SelfReference(ValueError):
|
class SelfReference(ValueError):
|
||||||
@@ -64,7 +78,7 @@ def get_model_fullname_from_string(model_string: str,
|
|||||||
raise SelfReference()
|
raise SelfReference()
|
||||||
|
|
||||||
if '.' not in model_string:
|
if '.' not in model_string:
|
||||||
raise InvalidModelString(model_string)
|
raise SameFileModel(model_string)
|
||||||
|
|
||||||
app_name, model_name = model_string.split('.')
|
app_name, model_name = model_string.split('.')
|
||||||
return get_model_fullname(app_name, model_name, all_modules)
|
return get_model_fullname(app_name, model_name, all_modules)
|
||||||
@@ -93,12 +107,13 @@ def parse_bool(expr: Expression) -> Optional[bool]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def reparametrize_with(instance: Instance, new_typevars: typing.List[Type]):
|
def reparametrize_instance(instance: Instance, new_args: typing.List[Type]) -> Instance:
|
||||||
return Instance(instance.type, args=new_typevars)
|
return Instance(instance.type, args=new_args,
|
||||||
|
line=instance.line, column=instance.column)
|
||||||
|
|
||||||
|
|
||||||
def fill_typevars_with_any(instance: Instance) -> Type:
|
def fill_typevars_with_any(instance: Instance) -> Instance:
|
||||||
return reparametrize_with(instance, [AnyType(TypeOfAny.unannotated)])
|
return reparametrize_instance(instance, [AnyType(TypeOfAny.unannotated)])
|
||||||
|
|
||||||
|
|
||||||
def extract_typevar_value(tp: Instance, typevar_name: str) -> Type:
|
def extract_typevar_value(tp: Instance, typevar_name: str) -> Type:
|
||||||
@@ -115,10 +130,10 @@ def fill_typevars(tp: Instance, type_to_fill: Instance) -> Instance:
|
|||||||
for typevar_arg in type_to_fill.args:
|
for typevar_arg in type_to_fill.args:
|
||||||
if isinstance(typevar_arg, TypeVarType):
|
if isinstance(typevar_arg, TypeVarType):
|
||||||
typevar_values.append(extract_typevar_value(tp, typevar_arg.name))
|
typevar_values.append(extract_typevar_value(tp, typevar_arg.name))
|
||||||
return reparametrize_with(type_to_fill, typevar_values)
|
return Instance(type_to_fill.type, typevar_values)
|
||||||
|
|
||||||
|
|
||||||
def get_argument_by_name(ctx: FunctionContext, name: str) -> Optional[Expression]:
|
def get_argument_by_name(ctx: typing.Union[FunctionContext, MethodContext], name: str) -> Optional[Expression]:
|
||||||
"""Return the expression for the specific argument.
|
"""Return the expression for the specific argument.
|
||||||
|
|
||||||
This helper should only be used with non-star arguments.
|
This helper should only be used with non-star arguments.
|
||||||
@@ -133,7 +148,7 @@ def get_argument_by_name(ctx: FunctionContext, name: str) -> Optional[Expression
|
|||||||
return args[0]
|
return args[0]
|
||||||
|
|
||||||
|
|
||||||
def get_argument_type_by_name(ctx: FunctionContext, name: str) -> Optional[Type]:
|
def get_argument_type_by_name(ctx: typing.Union[FunctionContext, MethodContext], name: str) -> Optional[Type]:
|
||||||
"""Return the type for the specific argument.
|
"""Return the type for the specific argument.
|
||||||
|
|
||||||
This helper should only be used with non-star arguments.
|
This helper should only be used with non-star arguments.
|
||||||
@@ -146,3 +161,138 @@ def get_argument_type_by_name(ctx: FunctionContext, name: str) -> Optional[Type]
|
|||||||
# Either an error or no value passed.
|
# Either an error or no value passed.
|
||||||
return None
|
return None
|
||||||
return arg_types[0]
|
return arg_types[0]
|
||||||
|
|
||||||
|
|
||||||
|
def get_setting_expr(api: TypeChecker, setting_name: str) -> Optional[Expression]:
|
||||||
|
try:
|
||||||
|
settings_sym = api.modules['django.conf'].names['settings']
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
settings_type: TypeInfo = settings_sym.type.type
|
||||||
|
auth_user_model_sym = settings_type.get(setting_name)
|
||||||
|
if not auth_user_model_sym:
|
||||||
|
return None
|
||||||
|
|
||||||
|
module, _, name = auth_user_model_sym.fullname.rpartition('.')
|
||||||
|
if module not in api.modules:
|
||||||
|
return None
|
||||||
|
|
||||||
|
module_file = api.modules.get(module)
|
||||||
|
for name_expr, value_expr in iter_over_assignments(module_file):
|
||||||
|
if isinstance(name_expr, NameExpr) and name_expr.name == setting_name:
|
||||||
|
return value_expr
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def iter_over_assignments(class_or_module: typing.Union[ClassDef, MypyFile]
|
||||||
|
) -> typing.Iterator[typing.Tuple[Lvalue, Expression]]:
|
||||||
|
if isinstance(class_or_module, ClassDef):
|
||||||
|
statements = class_or_module.defs.body
|
||||||
|
else:
|
||||||
|
statements = class_or_module.defs
|
||||||
|
|
||||||
|
for stmt in statements:
|
||||||
|
if not isinstance(stmt, AssignmentStmt):
|
||||||
|
continue
|
||||||
|
if len(stmt.lvalues) > 1:
|
||||||
|
# not supported yet
|
||||||
|
continue
|
||||||
|
yield stmt.lvalues[0], stmt.rvalue
|
||||||
|
|
||||||
|
|
||||||
|
def extract_field_setter_type(tp: Instance) -> Optional[Type]:
|
||||||
|
""" Extract __set__ value of a field. """
|
||||||
|
if tp.type.has_base(FIELD_FULLNAME):
|
||||||
|
return tp.args[0]
|
||||||
|
# GenericForeignKey
|
||||||
|
if tp.type.has_base(GENERIC_FOREIGN_KEY_FULLNAME):
|
||||||
|
return AnyType(TypeOfAny.special_form)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def extract_field_getter_type(tp: Instance) -> Optional[Type]:
|
||||||
|
if not isinstance(tp, Instance):
|
||||||
|
return None
|
||||||
|
if tp.type.has_base(FIELD_FULLNAME):
|
||||||
|
return tp.args[1]
|
||||||
|
# GenericForeignKey
|
||||||
|
if tp.type.has_base(GENERIC_FOREIGN_KEY_FULLNAME):
|
||||||
|
return AnyType(TypeOfAny.special_form)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_django_metadata(model: TypeInfo) -> Dict[str, typing.Any]:
|
||||||
|
return model.metadata.setdefault('django', {})
|
||||||
|
|
||||||
|
|
||||||
|
def get_related_field_primary_key_names(base_model: TypeInfo) -> typing.List[str]:
|
||||||
|
django_metadata = get_django_metadata(base_model)
|
||||||
|
return django_metadata.setdefault('related_field_primary_keys', [])
|
||||||
|
|
||||||
|
|
||||||
|
def get_fields_metadata(model: TypeInfo) -> Dict[str, typing.Any]:
|
||||||
|
return get_django_metadata(model).setdefault('fields', {})
|
||||||
|
|
||||||
|
|
||||||
|
def extract_explicit_set_type_of_model_primary_key(model: TypeInfo) -> Optional[Type]:
|
||||||
|
"""
|
||||||
|
If field with primary_key=True is set on the model, extract its __set__ type.
|
||||||
|
"""
|
||||||
|
for field_name, props in get_fields_metadata(model).items():
|
||||||
|
is_primary_key = props.get('primary_key', False)
|
||||||
|
if is_primary_key:
|
||||||
|
return extract_field_setter_type(model.names[field_name].type)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def extract_primary_key_type_for_get(model: TypeInfo) -> Optional[Type]:
|
||||||
|
for field_name, props in get_fields_metadata(model).items():
|
||||||
|
is_primary_key = props.get('primary_key', False)
|
||||||
|
if is_primary_key:
|
||||||
|
return extract_field_getter_type(model.names[field_name].type)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def make_optional(typ: Type):
|
||||||
|
return UnionType.make_union([typ, NoneTyp()])
|
||||||
|
|
||||||
|
|
||||||
|
def make_required(typ: Type) -> Type:
|
||||||
|
if not isinstance(typ, UnionType):
|
||||||
|
return typ
|
||||||
|
items = [item for item in typ.items if not isinstance(item, NoneTyp)]
|
||||||
|
# will reduce to Instance, if only one item
|
||||||
|
return UnionType.make_union(items)
|
||||||
|
|
||||||
|
|
||||||
|
def is_optional(typ: Type) -> bool:
|
||||||
|
if not isinstance(typ, UnionType):
|
||||||
|
return False
|
||||||
|
|
||||||
|
return any([isinstance(item, NoneTyp) for item in typ.items])
|
||||||
|
|
||||||
|
|
||||||
|
def has_any_of_bases(info: TypeInfo, bases: typing.Sequence[str]) -> bool:
|
||||||
|
for base_fullname in bases:
|
||||||
|
if info.has_base(base_fullname):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def is_none_expr(expr: Expression) -> bool:
|
||||||
|
return isinstance(expr, NameExpr) and expr.fullname == 'builtins.None'
|
||||||
|
|
||||||
|
|
||||||
|
def get_nested_meta_node_for_current_class(info: TypeInfo) -> Optional[TypeInfo]:
|
||||||
|
metaclass_sym = info.names.get('Meta')
|
||||||
|
if metaclass_sym is not None and isinstance(metaclass_sym.node, TypeInfo):
|
||||||
|
return metaclass_sym.node
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_assigned_value_for_class(type_info: TypeInfo, name: str) -> Optional[Expression]:
|
||||||
|
for lvalue, rvalue in iter_over_assignments(type_info.defn):
|
||||||
|
if isinstance(lvalue, NameExpr) and lvalue.name == name:
|
||||||
|
return rvalue
|
||||||
|
return None
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user