mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 04:34:29 +08:00
Merge pull request #10 from mkurnikov/master
Latest changes from Monkeytype fork
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
*.egg-info
|
||||
__pycache__/
|
||||
out/
|
||||
/test_sqlite.py
|
||||
/test_sqlite.py
|
||||
/django
|
||||
2
django-stubs/apps/__init__.pyi
Normal file
2
django-stubs/apps/__init__.pyi
Normal file
@@ -0,0 +1,2 @@
|
||||
from .config import AppConfig as AppConfig
|
||||
from .registry import apps as apps
|
||||
@@ -1,5 +1,4 @@
|
||||
from functools import partial
|
||||
from typing import Any, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.db.migrations.state import AppConfigStub
|
||||
@@ -15,12 +14,15 @@ class Apps:
|
||||
apps_ready: bool = ...
|
||||
loading: bool = ...
|
||||
def __init__(
|
||||
self, installed_apps: Union[List[AppConfigStub], Tuple] = ...
|
||||
self,
|
||||
installed_apps: Optional[
|
||||
Union[List[AppConfigStub], List[str], Tuple]
|
||||
] = ...,
|
||||
) -> None: ...
|
||||
models_ready: bool = ...
|
||||
ready: bool = ...
|
||||
def populate(
|
||||
self, installed_apps: Union[List[AppConfigStub], Tuple, List[str]] = ...
|
||||
self, installed_apps: Union[List[AppConfigStub], List[str], Tuple] = ...
|
||||
) -> None: ...
|
||||
def check_apps_ready(self) -> None: ...
|
||||
def check_models_ready(self) -> None: ...
|
||||
@@ -36,7 +38,7 @@ class Apps:
|
||||
require_ready: bool = ...,
|
||||
) -> Type[Model]: ...
|
||||
def register_model(self, app_label: str, model: Type[Model]) -> None: ...
|
||||
def is_installed(self, app_name: Any): ...
|
||||
def is_installed(self, app_name: str) -> bool: ...
|
||||
def get_containing_app_config(
|
||||
self, object_name: str
|
||||
) -> Optional[AppConfig]: ...
|
||||
@@ -44,13 +46,15 @@ class Apps:
|
||||
self, app_label: str, model_name: str
|
||||
) -> Type[Model]: ...
|
||||
def get_swappable_settings_name(self, to_string: str) -> Optional[str]: ...
|
||||
def set_available_apps(self, available: Any) -> None: ...
|
||||
def set_available_apps(self, available: List[str]) -> None: ...
|
||||
def unset_available_apps(self) -> None: ...
|
||||
def set_installed_apps(self, installed: List[str]) -> None: ...
|
||||
def set_installed_apps(
|
||||
self, installed: Union[List[str], Tuple[str]]
|
||||
) -> None: ...
|
||||
def unset_installed_apps(self) -> None: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
def lazy_model_operation(
|
||||
self, function: partial, *model_keys: Any
|
||||
self, function: Callable, *model_keys: Any
|
||||
) -> None: ...
|
||||
def do_pending_operations(self, model: Type[Model]) -> None: ...
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from typing import Any, Callable, Optional, Tuple, Union
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.contrib.flatpages.sitemaps import FlatPageSitemap
|
||||
from django.contrib.sitemaps import Sitemap
|
||||
from django.urls import include as include
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
@@ -11,8 +14,19 @@ handler500: Any
|
||||
def url(
|
||||
regex: str,
|
||||
view: Optional[
|
||||
Union[Tuple[None, None, None], Tuple[str, str, str], Callable]
|
||||
Union[
|
||||
Callable,
|
||||
Tuple[List[Union[URLPattern, URLResolver]], str, str],
|
||||
Tuple[Union[List[URLPattern], List[URLResolver]], None, None],
|
||||
]
|
||||
],
|
||||
kwargs: Any = ...,
|
||||
kwargs: Optional[
|
||||
Union[
|
||||
Dict[str, Dict[str, Type[FlatPageSitemap]]],
|
||||
Dict[str, Dict[str, Sitemap]],
|
||||
Dict[str, OrderedDict],
|
||||
Dict[str, str],
|
||||
]
|
||||
] = ...,
|
||||
name: Optional[str] = ...,
|
||||
) -> Union[URLResolver, URLPattern]: ...
|
||||
) -> Union[URLPattern, URLResolver]: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
def i18n_patterns(
|
||||
*urls: Any, prefix_default_language: bool = ...
|
||||
) -> Union[List[URLPattern], List[List[Any]], List[URLResolver]]: ...
|
||||
) -> Union[List[List[Any]], List[URLPattern], List[URLResolver]]: ...
|
||||
def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ...
|
||||
|
||||
urlpatterns: Any
|
||||
|
||||
0
django-stubs/contrib/__init__.pyi
Normal file
0
django-stubs/contrib/__init__.pyi
Normal file
@@ -63,15 +63,7 @@ class FieldListFilter(ListFilter):
|
||||
def register(
|
||||
cls,
|
||||
test: Callable,
|
||||
list_filter_class: Type[
|
||||
Union[
|
||||
BooleanFieldListFilter,
|
||||
AllValuesFieldListFilter,
|
||||
DateFieldListFilter,
|
||||
RelatedFieldListFilter,
|
||||
ChoicesFieldListFilter,
|
||||
]
|
||||
],
|
||||
list_filter_class: Type[FieldListFilter],
|
||||
take_priority: bool = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
@@ -115,7 +107,7 @@ class RelatedFieldListFilter(FieldListFilter):
|
||||
field: FieldCacheMixin,
|
||||
request: WSGIRequest,
|
||||
model_admin: ModelAdmin,
|
||||
) -> Union[List[Tuple[str, str]], List[Tuple[int, str]]]: ...
|
||||
) -> List[Tuple[Union[int, str], str]]: ...
|
||||
def choices(self, changelist: Any) -> None: ...
|
||||
|
||||
class BooleanFieldListFilter(FieldListFilter):
|
||||
@@ -209,4 +201,4 @@ class RelatedOnlyFieldListFilter(RelatedFieldListFilter):
|
||||
used_parameters: Dict[Any, Any]
|
||||
def field_choices(
|
||||
self, field: RelatedField, request: WSGIRequest, model_admin: ModelAdmin
|
||||
) -> Union[List[Tuple[str, str]], List[Tuple[int, str]]]: ...
|
||||
) -> List[Tuple[Union[int, str], str]]: ...
|
||||
|
||||
@@ -4,7 +4,7 @@ from django import forms
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.db.models.fields import AutoField
|
||||
from django.forms.utils import ErrorDict
|
||||
from django.forms.widgets import Media
|
||||
from django.forms.widgets import Media, Widget
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
ACTION_CHECKBOX_NAME: str
|
||||
@@ -77,7 +77,7 @@ class Fieldline:
|
||||
readonly_fields: Optional[Any] = ...,
|
||||
model_admin: Optional[Any] = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[Union[AdminReadonlyField, AdminField]]: ...
|
||||
def __iter__(self) -> Iterator[Union[AdminField, AdminReadonlyField]]: ...
|
||||
def errors(self) -> SafeText: ...
|
||||
|
||||
class AdminField:
|
||||
@@ -133,7 +133,9 @@ class InlineAdminFormSet:
|
||||
has_view_permission: bool = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[InlineAdminForm]: ...
|
||||
def fields(self) -> Iterator[Dict[str, Any]]: ...
|
||||
def fields(
|
||||
self
|
||||
) -> Iterator[Dict[str, Union[Dict[str, bool], bool, Widget, str]]]: ...
|
||||
def inline_formset_data(self) -> str: ...
|
||||
@property
|
||||
def forms(self): ...
|
||||
|
||||
@@ -18,18 +18,13 @@ class LogEntryManager(models.Manager):
|
||||
self,
|
||||
user_id: int,
|
||||
content_type_id: int,
|
||||
object_id: Union[str, UUID, int],
|
||||
object_id: Union[int, str, UUID],
|
||||
object_repr: str,
|
||||
action_flag: int,
|
||||
change_message: Union[
|
||||
List[Dict[str, Dict[str, Union[str, List[str]]]]],
|
||||
Dict[str, Dict[str, List[str]]],
|
||||
List[Dict[str, Dict[str, Union[List[str], str]]]],
|
||||
str,
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Dict[str, List[str]]], Dict[str, Dict[str, str]]
|
||||
]
|
||||
],
|
||||
] = ...,
|
||||
) -> LogEntry: ...
|
||||
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from django.contrib.admin.filters import SimpleListFilter
|
||||
from django.contrib.admin.models import LogEntry
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.contrib.admin.views.main import ChangeList
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import CharField, Field
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.related import (ForeignKey, ManyToManyField,
|
||||
RelatedField)
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms.fields import Field, TypedChoiceField
|
||||
from django.forms.models import ModelChoiceField
|
||||
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
||||
from django.forms.widgets import Media
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.http.response import (HttpResponse, HttpResponseBase,
|
||||
HttpResponseRedirect, JsonResponse)
|
||||
from django.urls.resolvers import URLPattern
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
IS_POPUP_VAR: str
|
||||
@@ -27,7 +31,7 @@ VERTICAL: Any
|
||||
def get_content_type_for_model(
|
||||
obj: Union[Type[Model], Model]
|
||||
) -> ContentType: ...
|
||||
def get_ul_class(radio_style: Any): ...
|
||||
def get_ul_class(radio_style: int) -> str: ...
|
||||
|
||||
class IncorrectLookupParameters(Exception): ...
|
||||
|
||||
@@ -58,42 +62,48 @@ class BaseModelAdmin:
|
||||
self, db_field: Field, request: WSGIRequest, **kwargs: Any
|
||||
) -> Optional[Field]: ...
|
||||
def formfield_for_choice_field(
|
||||
self, db_field: CharField, request: WSGIRequest, **kwargs: Any
|
||||
self, db_field: Field, request: WSGIRequest, **kwargs: Any
|
||||
) -> TypedChoiceField: ...
|
||||
def get_field_queryset(
|
||||
self, db: None, db_field: ForeignKey, request: WSGIRequest
|
||||
) -> None: ...
|
||||
self, db: None, db_field: RelatedField, request: WSGIRequest
|
||||
) -> Optional[QuerySet]: ...
|
||||
def formfield_for_foreignkey(
|
||||
self, db_field: ForeignKey, request: WSGIRequest, **kwargs: Any
|
||||
) -> Optional[ModelChoiceField]: ...
|
||||
def formfield_for_manytomany(
|
||||
self, db_field: Any, request: Any, **kwargs: Any
|
||||
): ...
|
||||
self, db_field: ManyToManyField, request: WSGIRequest, **kwargs: Any
|
||||
) -> ModelMultipleChoiceField: ...
|
||||
def get_autocomplete_fields(self, request: WSGIRequest) -> Tuple: ...
|
||||
def get_view_on_site_url(self, obj: Optional[Model] = ...) -> None: ...
|
||||
def get_view_on_site_url(
|
||||
self, obj: Optional[Model] = ...
|
||||
) -> Optional[str]: ...
|
||||
def get_empty_value_display(self) -> SafeText: ...
|
||||
def get_exclude(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> None: ...
|
||||
def get_fields(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> List[str]: ...
|
||||
) -> Union[List[Union[Callable, str]], Tuple[str, str]]: ...
|
||||
def get_fieldsets(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Union[
|
||||
Tuple[Tuple[None, Dict[str, Tuple[Tuple[str, str]]]]],
|
||||
List[Tuple[None, Dict[str, List[str]]]],
|
||||
List[Tuple[None, Dict[str, List[Union[Callable, str]]]]],
|
||||
Tuple[
|
||||
Tuple[Optional[str], Dict[str, Tuple[Union[Tuple[str, str], str]]]]
|
||||
],
|
||||
]: ...
|
||||
def get_ordering(self, request: WSGIRequest) -> Tuple: ...
|
||||
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
|
||||
def get_readonly_fields(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Tuple: ...
|
||||
) -> Union[List[str], Tuple]: ...
|
||||
def get_prepopulated_fields(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Dict[Any, Any]: ...
|
||||
) -> Dict[str, Tuple[str]]: ...
|
||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
||||
def get_sortable_by(self, request: WSGIRequest) -> Tuple[str]: ...
|
||||
def lookup_allowed(self, lookup: Any, value: Any): ...
|
||||
def get_sortable_by(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[Callable], List[str], Tuple]: ...
|
||||
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
||||
def to_field_allowed(self, request: WSGIRequest, to_field: str) -> bool: ...
|
||||
def has_add_permission(self, request: WSGIRequest) -> bool: ...
|
||||
def has_change_permission(
|
||||
@@ -105,18 +115,14 @@ class BaseModelAdmin:
|
||||
def has_view_permission(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> bool: ...
|
||||
def has_module_permission(self, request: Any): ...
|
||||
def has_module_permission(self, request: WSGIRequest) -> bool: ...
|
||||
|
||||
class ModelAdmin(BaseModelAdmin):
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.files.FileField,
|
||||
django.db.models.fields.DateTimeCheckMixin,
|
||||
django.db.models.fields.Field,
|
||||
]
|
||||
],
|
||||
Dict[
|
||||
@@ -124,15 +130,7 @@ class ModelAdmin(BaseModelAdmin):
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
django.forms.widgets.Widget,
|
||||
]
|
||||
],
|
||||
],
|
||||
@@ -168,16 +166,18 @@ class ModelAdmin(BaseModelAdmin):
|
||||
model: Type[django.db.models.base.Model] = ...
|
||||
opts: django.db.models.options.Options = ...
|
||||
admin_site: django.contrib.admin.sites.AdminSite = ...
|
||||
def __init__(self, model: Any, admin_site: Any) -> 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_urls(self): ...
|
||||
def get_urls(self) -> List[URLPattern]: ...
|
||||
@property
|
||||
def urls(self): ...
|
||||
def urls(self) -> List[URLPattern]: ...
|
||||
@property
|
||||
def media(self) -> Media: ...
|
||||
def get_model_perms(self, request: Any): ...
|
||||
def get_model_perms(self, request: WSGIRequest) -> Dict[str, bool]: ...
|
||||
def get_form(
|
||||
self,
|
||||
request: Any,
|
||||
@@ -209,13 +209,18 @@ class ModelAdmin(BaseModelAdmin):
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
object: Model,
|
||||
message: List[Dict[str, Dict[str, str]]],
|
||||
message: Union[
|
||||
Dict[str, Dict[Any, Any]], List[Dict[str, Dict[str, str]]]
|
||||
],
|
||||
) -> LogEntry: ...
|
||||
def log_change(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
object: Model,
|
||||
message: List[Dict[str, Dict[str, Union[str, List[str]]]]],
|
||||
message: Union[
|
||||
Dict[str, Dict[str, List[str]]],
|
||||
List[Dict[str, Dict[str, Union[List[str], str]]]],
|
||||
],
|
||||
) -> LogEntry: ...
|
||||
def log_deletion(
|
||||
self, request: WSGIRequest, object: Model, object_repr: str
|
||||
@@ -225,26 +230,42 @@ class ModelAdmin(BaseModelAdmin):
|
||||
def get_action_choices(
|
||||
self, request: WSGIRequest, default_choices: List[Tuple[str, str]] = ...
|
||||
) -> List[Tuple[str, str]]: ...
|
||||
def get_action(self, action: Any): ...
|
||||
def get_list_display(self, request: WSGIRequest) -> Tuple[str]: ...
|
||||
def get_action(
|
||||
self, action: Union[Callable, str]
|
||||
) -> Tuple[Callable, str, str]: ...
|
||||
def get_list_display(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[Callable], List[str], Tuple[str]]: ...
|
||||
def get_list_display_links(
|
||||
self, request: WSGIRequest, list_display: Tuple[str]
|
||||
) -> List[str]: ...
|
||||
def get_list_filter(self, request: WSGIRequest) -> Tuple: ...
|
||||
def get_list_select_related(self, request: WSGIRequest) -> bool: ...
|
||||
def get_search_fields(self, request: WSGIRequest) -> Tuple: ...
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
list_display: Union[List[Callable], List[str], Tuple[str]],
|
||||
) -> Optional[Union[List[Callable], List[str], Tuple[str]]]: ...
|
||||
def get_list_filter(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[Type[SimpleListFilter]], List[str], Tuple]: ...
|
||||
def get_list_select_related(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[Tuple, bool]: ...
|
||||
def get_search_fields(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[str], Tuple]: ...
|
||||
def get_search_results(
|
||||
self, request: WSGIRequest, queryset: QuerySet, search_term: str
|
||||
) -> Tuple[QuerySet, bool]: ...
|
||||
def get_preserved_filters(self, request: WSGIRequest) -> str: ...
|
||||
def construct_change_message(
|
||||
self, request: Any, form: Any, formsets: Any, add: bool = ...
|
||||
): ...
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
form: AdminPasswordChangeForm,
|
||||
formsets: None,
|
||||
add: bool = ...,
|
||||
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
||||
def message_user(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
message: str,
|
||||
level: int = ...,
|
||||
level: Union[int, str] = ...,
|
||||
extra_tags: str = ...,
|
||||
fail_silently: bool = ...,
|
||||
) -> None: ...
|
||||
@@ -253,7 +274,9 @@ class ModelAdmin(BaseModelAdmin):
|
||||
self, request: Any, obj: Any, form: Any, change: Any
|
||||
) -> None: ...
|
||||
def delete_model(self, request: WSGIRequest, obj: Model) -> None: ...
|
||||
def delete_queryset(self, request: Any, queryset: Any) -> None: ...
|
||||
def delete_queryset(
|
||||
self, request: WSGIRequest, queryset: QuerySet
|
||||
) -> None: ...
|
||||
def save_formset(
|
||||
self, request: Any, form: Any, formset: Any, change: Any
|
||||
) -> None: ...
|
||||
@@ -279,11 +302,11 @@ class ModelAdmin(BaseModelAdmin):
|
||||
self, request: WSGIRequest, obj: Model
|
||||
) -> HttpResponseRedirect: ...
|
||||
def response_post_save_change(
|
||||
self, request: WSGIRequest, obj: User
|
||||
self, request: WSGIRequest, obj: Model
|
||||
) -> HttpResponseRedirect: ...
|
||||
def response_action(
|
||||
self, request: WSGIRequest, queryset: QuerySet
|
||||
) -> Optional[TemplateResponse]: ...
|
||||
) -> Optional[HttpResponseBase]: ...
|
||||
def response_delete(
|
||||
self, request: WSGIRequest, obj_display: str, obj_id: int
|
||||
) -> HttpResponse: ...
|
||||
@@ -297,15 +320,15 @@ class ModelAdmin(BaseModelAdmin):
|
||||
) -> List[Any]: ...
|
||||
def get_changeform_initial_data(
|
||||
self, request: WSGIRequest
|
||||
) -> Dict[Any, Any]: ...
|
||||
) -> Dict[str, str]: ...
|
||||
def changeform_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
object_id: Optional[str] = ...,
|
||||
form_url: str = ...,
|
||||
extra_context: None = ...,
|
||||
extra_context: Optional[Dict[str, bool]] = ...,
|
||||
) -> Any: ...
|
||||
def autocomplete_view(self, request: Any): ...
|
||||
def autocomplete_view(self, request: WSGIRequest) -> JsonResponse: ...
|
||||
def add_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
@@ -317,13 +340,13 @@ class ModelAdmin(BaseModelAdmin):
|
||||
request: WSGIRequest,
|
||||
object_id: str,
|
||||
form_url: str = ...,
|
||||
extra_context: None = ...,
|
||||
extra_context: Optional[Dict[str, bool]] = ...,
|
||||
) -> HttpResponse: ...
|
||||
def changelist_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
extra_context: Optional[Dict[str, str]] = ...,
|
||||
) -> HttpResponse: ...
|
||||
) -> HttpResponseBase: ...
|
||||
def get_deleted_objects(
|
||||
self, objs: QuerySet, request: WSGIRequest
|
||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||
@@ -332,7 +355,7 @@ class ModelAdmin(BaseModelAdmin):
|
||||
) -> Any: ...
|
||||
def history_view(
|
||||
self, request: WSGIRequest, object_id: str, extra_context: None = ...
|
||||
) -> TemplateResponse: ...
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class InlineModelAdmin(BaseModelAdmin):
|
||||
model: Any = ...
|
||||
@@ -352,7 +375,9 @@ class InlineModelAdmin(BaseModelAdmin):
|
||||
parent_model: Any = ...
|
||||
opts: Any = ...
|
||||
has_registered_model: Any = ...
|
||||
def __init__(self, parent_model: Any, admin_site: Any) -> None: ...
|
||||
def __init__(
|
||||
self, parent_model: Union[Type[Model], Model], admin_site: AdminSite
|
||||
) -> None: ...
|
||||
@property
|
||||
def media(self) -> Media: ...
|
||||
def get_extra(
|
||||
@@ -363,7 +388,7 @@ class InlineModelAdmin(BaseModelAdmin):
|
||||
) -> None: ...
|
||||
def get_max_num(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
) -> Optional[int]: ...
|
||||
fields: Any = ...
|
||||
def get_formset(
|
||||
self, request: Any, obj: Optional[Any] = ..., **kwargs: Any
|
||||
|
||||
@@ -31,7 +31,7 @@ class AdminSite:
|
||||
def register(
|
||||
self,
|
||||
model_or_iterable: Union[
|
||||
Tuple[Type[Model]], Type[Model], List[Type[Model]]
|
||||
List[Type[Model]], Tuple[Type[Model]], Type[Model]
|
||||
],
|
||||
admin_class: Optional[Type[ModelAdmin]] = ...,
|
||||
**options: Any
|
||||
|
||||
@@ -15,7 +15,9 @@ register: Any
|
||||
DOT: str
|
||||
|
||||
def paginator_number(cl: ChangeList, i: int) -> SafeText: ...
|
||||
def pagination(cl: ChangeList) -> Dict[str, Any]: ...
|
||||
def pagination(
|
||||
cl: ChangeList
|
||||
) -> Dict[str, Union[List[Union[int, str]], ChangeList, int, range, str]]: ...
|
||||
def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def result_headers(
|
||||
cl: ChangeList
|
||||
@@ -30,18 +32,24 @@ class ResultList(list):
|
||||
|
||||
def results(cl: ChangeList) -> Iterator[ResultList]: ...
|
||||
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
|
||||
def result_list(cl: ChangeList) -> Dict[str, Any]: ...
|
||||
def result_list(
|
||||
cl: ChangeList
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Dict[str, Optional[Union[int, str]]]],
|
||||
List[ResultList],
|
||||
List[BoundField],
|
||||
ChangeList,
|
||||
int,
|
||||
],
|
||||
]: ...
|
||||
def result_list_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def date_hierarchy(
|
||||
cl: ChangeList
|
||||
) -> Optional[
|
||||
Union[
|
||||
Dict[str, Union[bool, Dict[str, str], List[Any]]],
|
||||
Dict[str, Union[bool, Dict[str, str], List[Dict[str, str]]]],
|
||||
]
|
||||
]: ...
|
||||
) -> Optional[Dict[str, Union[Dict[str, str], List[Dict[str, str]], bool]]]: ...
|
||||
def date_hierarchy_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def search_form(cl: ChangeList) -> Dict[str, Union[ChangeList, bool, str]]: ...
|
||||
def search_form(cl: ChangeList) -> Dict[str, Union[bool, ChangeList, str]]: ...
|
||||
def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def admin_list_filter(cl: ChangeList, spec: FieldListFilter) -> SafeText: ...
|
||||
def admin_actions(context: RequestContext) -> RequestContext: ...
|
||||
|
||||
@@ -8,9 +8,9 @@ from django.utils.safestring import SafeText
|
||||
register: Any
|
||||
|
||||
def admin_urlname(value: Options, arg: SafeText) -> str: ...
|
||||
def admin_urlquote(value: Union[str, UUID, int]) -> Union[str, UUID, int]: ...
|
||||
def admin_urlquote(value: Union[int, str, UUID]) -> Union[int, str, UUID]: ...
|
||||
def add_preserved_filters(
|
||||
context: Union[Dict[str, Union[str, Options]], RequestContext],
|
||||
context: Union[Dict[str, Union[Options, str]], RequestContext],
|
||||
url: str,
|
||||
popup: bool = ...,
|
||||
to_field: Optional[str] = ...,
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
from datetime import date, datetime
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django.contrib.admin.options import BaseModelAdmin
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.deletion import Collector
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.reverse_related import ManyToOneRel, OneToOneRel
|
||||
from django.db.models.fields.reverse_related import (ForeignObjectRel,
|
||||
ManyToOneRel, OneToOneRel)
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.query import QuerySet
|
||||
from django.utils.safestring import SafeText
|
||||
@@ -19,29 +21,26 @@ class FieldIsAForeignKeyColumnName(Exception): ...
|
||||
|
||||
def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ...
|
||||
def prepare_lookup_value(
|
||||
key: str, value: Union[str, datetime]
|
||||
key: str, value: Union[datetime, str]
|
||||
) -> Union[bool, datetime, str]: ...
|
||||
def quote(s: Union[str, int]) -> Union[str, int]: ...
|
||||
def quote(s: Union[int, str, UUID]) -> Union[int, str, UUID]: ...
|
||||
def unquote(s: str) -> str: ...
|
||||
def flatten(
|
||||
fields: Union[
|
||||
List[Union[str, Callable]], Tuple[Tuple[str, str]], Tuple[str, str]
|
||||
List[Union[Callable, str]],
|
||||
List[Union[List[str], str]],
|
||||
List[Union[Tuple[str, str], str]],
|
||||
Tuple,
|
||||
]
|
||||
) -> List[Union[str, Callable]]: ...
|
||||
) -> List[Union[Callable, str]]: ...
|
||||
def flatten_fieldsets(
|
||||
fieldsets: Union[
|
||||
List[Tuple[None, Dict[str, List[Union[str, Callable]]]]],
|
||||
List[Tuple[Optional[str], Dict[str, Tuple[str]]]],
|
||||
Tuple[
|
||||
Union[
|
||||
Tuple[None, Dict[str, Tuple[Tuple[str, str]]]],
|
||||
Tuple[None, Dict[str, Tuple[str]]],
|
||||
]
|
||||
],
|
||||
Tuple[
|
||||
Tuple[str, Dict[str, Tuple[str]]], Tuple[str, Dict[str, Tuple[str]]]
|
||||
Tuple[Optional[str], Dict[str, Tuple[Union[Tuple[str, str], str]]]]
|
||||
],
|
||||
]
|
||||
) -> List[Union[str, Callable]]: ...
|
||||
) -> List[Union[Callable, str]]: ...
|
||||
def get_deleted_objects(
|
||||
objs: QuerySet, request: WSGIRequest, admin_site: AdminSite
|
||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||
@@ -59,7 +58,7 @@ class NestedObjects(Collector):
|
||||
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
|
||||
def collect(
|
||||
self,
|
||||
objs: Union[QuerySet, List[Model]],
|
||||
objs: Union[List[Model], QuerySet],
|
||||
source: Optional[Type[Model]] = ...,
|
||||
source_attr: Optional[str] = ...,
|
||||
**kwargs: Any
|
||||
@@ -69,56 +68,43 @@ class NestedObjects(Collector):
|
||||
) -> QuerySet: ...
|
||||
def nested(
|
||||
self, format_callback: Callable = ...
|
||||
) -> Union[
|
||||
List[Union[List[str], str]], List[Union[SafeText, List[SafeText]]]
|
||||
]: ...
|
||||
) -> Union[List[SafeText], List[int]]: ...
|
||||
def can_fast_delete(self, *args: Any, **kwargs: Any) -> bool: ...
|
||||
|
||||
def model_format_dict(obj: Any): ...
|
||||
def model_ngettext(obj: QuerySet, n: None = ...) -> str: ...
|
||||
def model_ngettext(
|
||||
obj: Union[Options, QuerySet], n: Optional[int] = ...
|
||||
) -> str: ...
|
||||
def lookup_field(
|
||||
name: Union[str, Callable], obj: Model, model_admin: BaseModelAdmin = ...
|
||||
) -> Union[
|
||||
Tuple[
|
||||
Union[str, Model, date, int, None],
|
||||
Union[str, Model, date, int, None],
|
||||
Union[str, Model, date, int, None],
|
||||
],
|
||||
Tuple[None, Callable, Callable],
|
||||
]: ...
|
||||
name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ...
|
||||
) -> Tuple[Optional[Field], Callable, Callable]: ...
|
||||
def label_for_field(
|
||||
name: Union[str, Callable],
|
||||
name: Union[Callable, str],
|
||||
model: Type[Model],
|
||||
model_admin: BaseModelAdmin = ...,
|
||||
model_admin: Optional[BaseModelAdmin] = ...,
|
||||
return_attr: bool = ...,
|
||||
) -> Union[
|
||||
Tuple[
|
||||
Union[Type[str], None, Callable, GenericForeignKey],
|
||||
Union[Type[str], None, Callable, GenericForeignKey],
|
||||
],
|
||||
str,
|
||||
]: ...
|
||||
) -> Union[Tuple[Optional[str], Union[Callable, Type[str]]], str]: ...
|
||||
def help_text_for_field(name: str, model: Type[Model]) -> str: ...
|
||||
def display_for_field(
|
||||
value: Optional[Union[int, str, date, Model]],
|
||||
value: Any,
|
||||
field: Union[Field, reverse_related.OneToOneRel],
|
||||
empty_value_display: SafeText,
|
||||
empty_value_display: str,
|
||||
) -> str: ...
|
||||
def display_for_value(
|
||||
value: Optional[Union[Callable, Model, int, str]],
|
||||
empty_value_display: SafeText,
|
||||
boolean: bool = ...,
|
||||
value: Any, empty_value_display: str, boolean: bool = ...
|
||||
) -> str: ...
|
||||
|
||||
class NotRelationField(Exception): ...
|
||||
|
||||
def get_model_from_relation(
|
||||
field: Union[Field, reverse_related.ManyToOneRel]
|
||||
field: Union[Field, reverse_related.ForeignObjectRel]
|
||||
) -> Type[Model]: ...
|
||||
def reverse_field_path(
|
||||
model: Type[Model], path: str
|
||||
) -> Tuple[Type[Model], str]: ...
|
||||
def get_fields_from_path(
|
||||
model: Type[Model], path: str
|
||||
) -> List[Union[FieldCacheMixin, Field]]: ...
|
||||
def construct_change_message(form: Any, formsets: Any, add: Any): ...
|
||||
) -> List[Union[Field, FieldCacheMixin]]: ...
|
||||
def construct_change_message(
|
||||
form: AdminPasswordChangeForm, formsets: None, add: bool
|
||||
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
||||
|
||||
0
django-stubs/contrib/admin/views/__init__.pyi
Normal file
0
django-stubs/contrib/admin/views/__init__.pyi
Normal file
@@ -47,29 +47,27 @@ class ChangeList:
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
model: Type[Model],
|
||||
list_display: Union[List[Union[str, Callable]], Tuple[str]],
|
||||
list_display: Union[List[Union[Callable, str]], Tuple[str]],
|
||||
list_display_links: Optional[
|
||||
Union[List[str], Tuple[str], List[Callable]]
|
||||
Union[List[Callable], List[str], Tuple[str]]
|
||||
],
|
||||
list_filter: Union[Tuple, List[Type[SimpleListFilter]], List[str]],
|
||||
list_filter: Union[List[Type[SimpleListFilter]], List[str], Tuple],
|
||||
date_hierarchy: Optional[str],
|
||||
search_fields: Union[Tuple, List[str]],
|
||||
list_select_related: Union[bool, Tuple],
|
||||
search_fields: Union[List[str], Tuple],
|
||||
list_select_related: Union[Tuple, bool],
|
||||
list_per_page: int,
|
||||
list_max_show_all: int,
|
||||
list_editable: Union[List[str], Tuple],
|
||||
model_admin: ModelAdmin,
|
||||
sortable_by: Union[Tuple, List[Callable], List[str]],
|
||||
sortable_by: Union[List[Callable], List[str], Tuple],
|
||||
) -> None: ...
|
||||
def get_filters_params(self, params: None = ...) -> Dict[str, str]: ...
|
||||
def get_filters(
|
||||
self, request: WSGIRequest
|
||||
) -> Tuple[List[ListFilter], bool, bool, bool]: ...
|
||||
) -> Tuple[List[ListFilter], bool, Dict[str, Union[bool, str]], bool]: ...
|
||||
def get_query_string(
|
||||
self,
|
||||
new_params: Optional[
|
||||
Union[Dict[str, Union[str, int]], Dict[str, None]]
|
||||
] = ...,
|
||||
new_params: Optional[Dict[str, None]] = ...,
|
||||
remove: Optional[List[str]] = ...,
|
||||
) -> str: ...
|
||||
result_count: Any = ...
|
||||
@@ -82,7 +80,7 @@ class ChangeList:
|
||||
paginator: Any = ...
|
||||
def get_results(self, request: WSGIRequest) -> None: ...
|
||||
def get_ordering_field(
|
||||
self, field_name: Union[str, Callable]
|
||||
self, field_name: Union[Callable, str]
|
||||
) -> Optional[Union[CombinedExpression, str]]: ...
|
||||
def get_ordering(
|
||||
self, request: WSGIRequest, queryset: QuerySet
|
||||
|
||||
@@ -1,124 +1,264 @@
|
||||
from typing import Any, Optional
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django import forms
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
from django.db.models.query_utils import Q
|
||||
from django.forms.fields import Field
|
||||
from django.forms.widgets import ChoiceWidget, Media, Widget
|
||||
from django.http.request import QueryDict
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
|
||||
|
||||
class FilteredSelectMultiple(forms.SelectMultiple):
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
verbose_name: Any = ...
|
||||
is_stacked: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Any,
|
||||
is_stacked: Any,
|
||||
attrs: Optional[Any] = ...,
|
||||
choices: Any = ...,
|
||||
verbose_name: str,
|
||||
is_stacked: bool,
|
||||
attrs: None = ...,
|
||||
choices: Tuple = ...,
|
||||
) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Union[List[Any], str],
|
||||
attrs: Optional[Dict[str, str]],
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[int, str]],
|
||||
List[
|
||||
Tuple[
|
||||
None,
|
||||
List[Dict[str, Union[Dict[Any, Any], int, str]]],
|
||||
int,
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, Union[int, str]], List[str], bool, str]],
|
||||
],
|
||||
]: ...
|
||||
|
||||
class AdminDateWidget(forms.DateInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
def __init__(
|
||||
self, attrs: Optional[Any] = ..., format: Optional[Any] = ...
|
||||
self,
|
||||
attrs: Optional[Dict[str, Union[int, str]]] = ...,
|
||||
format: None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class AdminTimeWidget(forms.TimeInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
def __init__(
|
||||
self, attrs: Optional[Any] = ..., format: Optional[Any] = ...
|
||||
self,
|
||||
attrs: Optional[Dict[str, Union[int, str]]] = ...,
|
||||
format: None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class AdminSplitDateTime(forms.SplitDateTimeWidget):
|
||||
attrs: Dict[Any, Any]
|
||||
widgets: List[django.forms.widgets.DateTimeBaseInput]
|
||||
template_name: str = ...
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[Union[List[str], datetime]],
|
||||
attrs: Optional[Dict[str, Union[bool, str]]],
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, Union[bool, str]],
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, Union[bool, str]], bool, str
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
]
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
]: ...
|
||||
|
||||
class AdminRadioSelect(forms.RadioSelect):
|
||||
attrs: Dict[str, str]
|
||||
template_name: str = ...
|
||||
|
||||
class AdminFileWidget(forms.ClearableFileInput):
|
||||
attrs: Dict[Any, Any]
|
||||
template_name: str = ...
|
||||
|
||||
def url_params_from_lookup_dict(lookups: Any): ...
|
||||
def url_params_from_lookup_dict(
|
||||
lookups: Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, List[str]],
|
||||
Dict[str, Tuple[str, str]],
|
||||
Dict[str, bool],
|
||||
Dict[str, str],
|
||||
Q,
|
||||
]
|
||||
) -> Dict[str, str]: ...
|
||||
|
||||
class ForeignKeyRawIdWidget(forms.TextInput):
|
||||
attrs: Dict[Any, Any]
|
||||
template_name: str = ...
|
||||
rel: Any = ...
|
||||
admin_site: Any = ...
|
||||
db: Any = ...
|
||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
||||
admin_site: django.contrib.admin.sites.AdminSite = ...
|
||||
db: None = ...
|
||||
def __init__(
|
||||
self,
|
||||
rel: Any,
|
||||
admin_site: Any,
|
||||
attrs: Optional[Any] = ...,
|
||||
using: Optional[Any] = ...,
|
||||
rel: ForeignObjectRel,
|
||||
admin_site: AdminSite,
|
||||
attrs: None = ...,
|
||||
using: None = ...,
|
||||
) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def base_url_parameters(self): ...
|
||||
def url_parameters(self): ...
|
||||
def label_and_url_for_value(self, value: Any): ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[Union[List[int], int, str, UUID]],
|
||||
attrs: Optional[Dict[str, Union[bool, str]]],
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]],
|
||||
str,
|
||||
],
|
||||
]: ...
|
||||
def base_url_parameters(self) -> Dict[str, str]: ...
|
||||
def url_parameters(self) -> Dict[str, str]: ...
|
||||
def label_and_url_for_value(
|
||||
self, value: Union[int, str, UUID]
|
||||
) -> Tuple[str, str]: ...
|
||||
|
||||
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
|
||||
admin_site: django.contrib.admin.sites.AdminSite
|
||||
attrs: Dict[Any, Any]
|
||||
db: None
|
||||
rel: django.db.models.fields.reverse_related.ManyToManyRel
|
||||
template_name: str = ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def url_parameters(self): ...
|
||||
def label_and_url_for_value(self, value: Any): ...
|
||||
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
|
||||
def format_value(self, value: Any): ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[List[int]],
|
||||
attrs: Optional[Dict[str, str]],
|
||||
) -> Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]]: ...
|
||||
def url_parameters(self) -> Dict[Any, Any]: ...
|
||||
def label_and_url_for_value(self, value: List[int]) -> Tuple[str, str]: ...
|
||||
def value_from_datadict(
|
||||
self, data: QueryDict, files: MultiValueDict, name: str
|
||||
) -> None: ...
|
||||
def format_value(self, value: Optional[List[int]]) -> str: ...
|
||||
|
||||
class RelatedFieldWidgetWrapper(forms.Widget):
|
||||
template_name: str = ...
|
||||
needs_multipart_form: Any = ...
|
||||
attrs: Any = ...
|
||||
choices: Any = ...
|
||||
widget: Any = ...
|
||||
rel: Any = ...
|
||||
can_add_related: Any = ...
|
||||
can_change_related: Any = ...
|
||||
can_delete_related: Any = ...
|
||||
can_view_related: Any = ...
|
||||
admin_site: Any = ...
|
||||
needs_multipart_form: bool = ...
|
||||
attrs: Dict[Any, Any] = ...
|
||||
choices: django.forms.models.ModelChoiceIterator = ...
|
||||
widget: django.contrib.admin.widgets.AutocompleteSelect = ...
|
||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
||||
can_add_related: bool = ...
|
||||
can_change_related: bool = ...
|
||||
can_delete_related: bool = ...
|
||||
can_view_related: bool = ...
|
||||
admin_site: django.contrib.admin.sites.AdminSite = ...
|
||||
def __init__(
|
||||
self,
|
||||
widget: Any,
|
||||
rel: Any,
|
||||
admin_site: Any,
|
||||
can_add_related: Optional[Any] = ...,
|
||||
widget: ChoiceWidget,
|
||||
rel: ForeignObjectRel,
|
||||
admin_site: AdminSite,
|
||||
can_add_related: Optional[bool] = ...,
|
||||
can_change_related: bool = ...,
|
||||
can_delete_related: bool = ...,
|
||||
can_view_related: bool = ...,
|
||||
) -> None: ...
|
||||
def __deepcopy__(self, memo: Any): ...
|
||||
def __deepcopy__(
|
||||
self,
|
||||
memo: Dict[
|
||||
int, Union[List[Union[Field, Widget]], OrderedDict, Field, Widget]
|
||||
],
|
||||
) -> RelatedFieldWidgetWrapper: ...
|
||||
@property
|
||||
def is_hidden(self): ...
|
||||
def is_hidden(self) -> bool: ...
|
||||
@property
|
||||
def media(self): ...
|
||||
def get_related_url(self, info: Any, action: Any, *args: Any): ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
|
||||
def value_omitted_from_data(self, data: Any, files: Any, name: Any): ...
|
||||
def id_for_label(self, id_: Any): ...
|
||||
def media(self) -> Media: ...
|
||||
def get_related_url(
|
||||
self, info: Tuple[str, str], action: str, *args: Any
|
||||
) -> str: ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[Union[int, str]],
|
||||
attrs: Optional[Dict[str, Union[bool, str]]],
|
||||
) -> Dict[str, Union[bool, str]]: ...
|
||||
def value_from_datadict(
|
||||
self, data: QueryDict, files: MultiValueDict, name: str
|
||||
) -> Optional[Union[List[str], str]]: ...
|
||||
def value_omitted_from_data(
|
||||
self, data: Dict[Any, Any], files: Dict[Any, Any], name: str
|
||||
) -> bool: ...
|
||||
def id_for_label(self, id_: str) -> str: ...
|
||||
|
||||
class AdminTextareaWidget(forms.Textarea):
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
attrs: Dict[str, str]
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminTextInputWidget(forms.TextInput):
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminEmailInputWidget(forms.EmailInput):
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminURLFieldWidget(forms.URLInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
template_name: str = ...
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
def get_context(
|
||||
self, name: str, value: Optional[str], attrs: Optional[Dict[str, str]]
|
||||
) -> Dict[
|
||||
str, Union[Dict[str, Optional[Union[Dict[str, str], bool, str]]], str]
|
||||
]: ...
|
||||
|
||||
class AdminIntegerFieldWidget(forms.NumberInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
class_name: str = ...
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
|
||||
class_name: str = ...
|
||||
@@ -134,19 +274,32 @@ class AutocompleteMixin:
|
||||
attrs: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
rel: Any,
|
||||
admin_site: Any,
|
||||
attrs: Optional[Any] = ...,
|
||||
choices: Any = ...,
|
||||
using: Optional[Any] = ...,
|
||||
rel: ForeignObjectRel,
|
||||
admin_site: AdminSite,
|
||||
attrs: Optional[Dict[str, str]] = ...,
|
||||
choices: Tuple = ...,
|
||||
using: None = ...,
|
||||
) -> None: ...
|
||||
def get_url(self): ...
|
||||
def get_url(self) -> str: ...
|
||||
def build_attrs(
|
||||
self, base_attrs: Any, extra_attrs: Optional[Any] = ...
|
||||
): ...
|
||||
def optgroups(self, name: Any, value: Any, attr: Optional[Any] = ...): ...
|
||||
self,
|
||||
base_attrs: Dict[str, str],
|
||||
extra_attrs: Optional[Dict[str, Union[bool, str]]] = ...,
|
||||
) -> Dict[str, Union[bool, str]]: ...
|
||||
def optgroups(
|
||||
self,
|
||||
name: str,
|
||||
value: List[str],
|
||||
attr: Dict[str, Union[bool, str]] = ...,
|
||||
) -> List[
|
||||
Tuple[
|
||||
None,
|
||||
List[Dict[str, Union[Dict[str, bool], Set[str], int, str]]],
|
||||
int,
|
||||
]
|
||||
]: ...
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
|
||||
class AutocompleteSelect(AutocompleteMixin, forms.Select): ...
|
||||
class AutocompleteSelectMultiple(AutocompleteMixin, forms.SelectMultiple): ...
|
||||
|
||||
0
django-stubs/contrib/admindocs/__init__.pyi
Normal file
0
django-stubs/contrib/admindocs/__init__.pyi
Normal file
@@ -4,8 +4,6 @@ from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import HttpResponse
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
from .utils import get_view_name
|
||||
|
||||
|
||||
class XViewMiddleware(MiddlewareMixin):
|
||||
get_response: None
|
||||
|
||||
@@ -45,7 +45,7 @@ class TemplateDetailView(BaseAdminDocsView):
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
|
||||
def get_return_data_type(func_name: Any): ...
|
||||
def get_readable_field_data_type(field: Union[str, Field]) -> str: ...
|
||||
def get_readable_field_data_type(field: Union[Field, str]) -> str: ...
|
||||
def extract_views_from_urlpatterns(
|
||||
urlpatterns: Any, base: str = ..., namespace: Optional[Any] = ...
|
||||
): ...
|
||||
|
||||
@@ -7,7 +7,6 @@ from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.options import Options
|
||||
from django.http.request import HttpRequest
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
from .signals import user_logged_in, user_logged_out, user_login_failed
|
||||
|
||||
@@ -24,7 +23,7 @@ def authenticate(
|
||||
def login(
|
||||
request: HttpRequest,
|
||||
user: AbstractBaseUser,
|
||||
backend: Optional[Union[str, Type[ModelBackend]]] = ...,
|
||||
backend: Optional[Union[Type[ModelBackend], str]] = ...,
|
||||
) -> None: ...
|
||||
def logout(request: HttpRequest) -> None: ...
|
||||
def get_user_model() -> Type[Model]: ...
|
||||
@@ -33,7 +32,7 @@ def get_user(
|
||||
) -> Union[AbstractBaseUser, AnonymousUser]: ...
|
||||
def get_permission_codename(action: str, opts: Options) -> str: ...
|
||||
def update_session_auth_hash(
|
||||
request: WSGIRequest, user: Union[SimpleLazyObject, AbstractUser]
|
||||
request: WSGIRequest, user: AbstractUser
|
||||
) -> None: ...
|
||||
|
||||
default_app_config: str
|
||||
|
||||
@@ -16,12 +16,8 @@ class GroupAdmin(admin.ModelAdmin):
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.files.FileField,
|
||||
django.db.models.fields.DateTimeCheckMixin,
|
||||
django.db.models.fields.Field,
|
||||
]
|
||||
],
|
||||
Dict[
|
||||
@@ -29,15 +25,7 @@ class GroupAdmin(admin.ModelAdmin):
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
django.forms.widgets.Widget,
|
||||
]
|
||||
],
|
||||
],
|
||||
@@ -59,12 +47,8 @@ class UserAdmin(admin.ModelAdmin):
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.files.FileField,
|
||||
django.db.models.fields.DateTimeCheckMixin,
|
||||
django.db.models.fields.Field,
|
||||
]
|
||||
],
|
||||
Dict[
|
||||
@@ -72,15 +56,7 @@ class UserAdmin(admin.ModelAdmin):
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
django.forms.widgets.Widget,
|
||||
]
|
||||
],
|
||||
],
|
||||
|
||||
@@ -10,7 +10,7 @@ class ModelBackend:
|
||||
def authenticate(
|
||||
self,
|
||||
request: Any,
|
||||
username: Optional[Union[str, int]] = ...,
|
||||
username: Optional[Union[int, str]] = ...,
|
||||
password: Optional[str] = ...,
|
||||
**kwargs: Any
|
||||
) -> Optional[AbstractBaseUser]: ...
|
||||
@@ -28,7 +28,7 @@ class ModelBackend:
|
||||
) -> Set[str]: ...
|
||||
def has_perm(
|
||||
self,
|
||||
user_obj: Union[AnonymousUser, AbstractBaseUser],
|
||||
user_obj: Union[AbstractBaseUser, AnonymousUser],
|
||||
perm: str,
|
||||
obj: Optional[str] = ...,
|
||||
) -> bool: ...
|
||||
|
||||
@@ -40,5 +40,5 @@ class AbstractBaseUser(models.Model):
|
||||
def get_email_field_name(cls) -> str: ...
|
||||
@classmethod
|
||||
def normalize_username(
|
||||
cls, username: Union[str, int]
|
||||
) -> Union[str, int]: ...
|
||||
cls, username: Union[int, str]
|
||||
) -> Union[int, str]: ...
|
||||
|
||||
@@ -15,13 +15,11 @@ class PermLookupDict:
|
||||
|
||||
class PermWrapper:
|
||||
user: django.utils.functional.SimpleLazyObject = ...
|
||||
def __init__(
|
||||
self, user: Union[SimpleLazyObject, AnonymousUser, User]
|
||||
) -> None: ...
|
||||
def __init__(self, user: Union[AnonymousUser, User]) -> None: ...
|
||||
def __getitem__(self, app_label: str) -> PermLookupDict: ...
|
||||
def __iter__(self) -> Any: ...
|
||||
def __contains__(self, perm_name: Union[str, bool]) -> bool: ...
|
||||
def __contains__(self, perm_name: Union[bool, str]) -> bool: ...
|
||||
|
||||
def auth(
|
||||
request: HttpRequest
|
||||
) -> Dict[str, Union[SimpleLazyObject, PermWrapper, User, AnonymousUser]]: ...
|
||||
) -> Dict[str, Union[PermWrapper, AnonymousUser, User]]: ...
|
||||
|
||||
@@ -12,7 +12,7 @@ def login_required(
|
||||
login_url: Optional[str] = ...,
|
||||
) -> Callable: ...
|
||||
def permission_required(
|
||||
perm: Union[str, List[str], Set[str]],
|
||||
perm: Union[List[str], Set[str], str],
|
||||
login_url: None = ...,
|
||||
raise_exception: bool = ...,
|
||||
) -> Callable: ...
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.contrib.auth.models import AbstractUser, User
|
||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
UserModel: Any
|
||||
|
||||
@@ -18,10 +17,8 @@ class ReadOnlyPasswordHashWidget(forms.Widget):
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[str, bool, None, Dict[Any, Any]]],
|
||||
Dict[str, Optional[Union[Dict[str, str], bool, str]]],
|
||||
List[Dict[str, str]],
|
||||
Dict[str, Union[str, bool, None, Dict[str, str]]],
|
||||
Dict[str, Union[str, bool, Dict[str, str]]],
|
||||
],
|
||||
]: ...
|
||||
|
||||
@@ -63,7 +60,7 @@ class UserChangeForm(forms.ModelForm):
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[str, Optional[Union[int, str, datetime.datetime, List[Any]]]]
|
||||
initial: Dict[str, Optional[Union[List[Any], datetime.datetime, int, str]]]
|
||||
instance: django.contrib.auth.models.User
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
@@ -114,7 +111,7 @@ class PasswordResetForm(forms.Form):
|
||||
self,
|
||||
subject_template_name: str,
|
||||
email_template_name: str,
|
||||
context: Dict[str, Union[str, AbstractBaseUser]],
|
||||
context: Dict[str, Union[AbstractBaseUser, str]],
|
||||
from_email: Optional[str],
|
||||
to_email: str,
|
||||
html_email_template_name: Optional[str] = ...,
|
||||
@@ -148,15 +145,10 @@ class SetPasswordForm(forms.Form):
|
||||
new_password2: Any = ...
|
||||
user: django.contrib.auth.models.User = ...
|
||||
def __init__(
|
||||
self,
|
||||
user: Optional[Union[SimpleLazyObject, AbstractBaseUser]],
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
self, user: Optional[AbstractBaseUser], *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def clean_new_password2(self) -> str: ...
|
||||
def save(
|
||||
self, commit: bool = ...
|
||||
) -> Union[AbstractBaseUser, SimpleLazyObject]: ...
|
||||
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
|
||||
|
||||
class PasswordChangeForm(SetPasswordForm):
|
||||
auto_id: str
|
||||
|
||||
0
django-stubs/contrib/auth/handlers/__init__.pyi
Normal file
0
django-stubs/contrib/auth/handlers/__init__.pyi
Normal file
@@ -22,4 +22,4 @@ class Command(BaseCommand):
|
||||
def handle(self, *args: Any, **options: Any) -> None: ...
|
||||
def get_input_data(
|
||||
self, field: Field, message: str, default: Optional[str] = ...
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
) -> Optional[Union[int, str]]: ...
|
||||
|
||||
@@ -80,10 +80,10 @@ class PermissionsMixin(models.Model):
|
||||
def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
|
||||
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
|
||||
def has_perm(
|
||||
self, perm: Union[str, Tuple[str, Any]], obj: Optional[str] = ...
|
||||
self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...
|
||||
) -> bool: ...
|
||||
def has_perms(
|
||||
self, perm_list: Union[Set[str], List[str], Tuple[str]], obj: None = ...
|
||||
self, perm_list: Union[List[str], Set[str], Tuple[str]], obj: None = ...
|
||||
) -> bool: ...
|
||||
def has_module_perms(self, app_label: str) -> bool: ...
|
||||
|
||||
|
||||
@@ -3,24 +3,19 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
|
||||
def get_default_password_validators() -> Union[
|
||||
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
|
||||
List[Union[UserAttributeSimilarityValidator, MinimumLengthValidator]],
|
||||
List[NumericPasswordValidator],
|
||||
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
|
||||
]: ...
|
||||
def get_password_validators(
|
||||
validator_config: List[Dict[str, Union[str, Dict[str, int]]]]
|
||||
validator_config: List[Dict[str, Union[Dict[str, int], str]]]
|
||||
) -> Union[
|
||||
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
|
||||
List[Union[UserAttributeSimilarityValidator, MinimumLengthValidator]],
|
||||
List[NumericPasswordValidator],
|
||||
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
|
||||
]: ...
|
||||
def validate_password(
|
||||
password: str,
|
||||
user: Optional[Union[AbstractBaseUser, SimpleLazyObject]] = ...,
|
||||
user: Optional[AbstractBaseUser] = ...,
|
||||
password_validators: Optional[List[Any]] = ...,
|
||||
) -> None: ...
|
||||
def password_changed(
|
||||
@@ -46,7 +41,7 @@ class UserAttributeSimilarityValidator:
|
||||
max_similarity: float = ...
|
||||
def __init__(
|
||||
self,
|
||||
user_attributes: Union[Tuple[str, str, str, str], List[str]] = ...,
|
||||
user_attributes: Union[List[str], Tuple[str, str, str, str]] = ...,
|
||||
max_similarity: float = ...,
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
||||
@@ -56,7 +51,7 @@ class CommonPasswordValidator:
|
||||
DEFAULT_PASSWORD_LIST_PATH: Any = ...
|
||||
passwords: Set[str] = ...
|
||||
def __init__(
|
||||
self, password_list_path: Union[str, PosixPath] = ...
|
||||
self, password_list_path: Union[PosixPath, str] = ...
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
@@ -11,7 +11,6 @@ from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.edit import FormView
|
||||
|
||||
@@ -37,16 +36,13 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[Dict[Any, Any], Dict[str, str], MultiValueDict, HttpRequest]
|
||||
],
|
||||
str, Optional[Union[Dict[str, str], HttpRequest, MultiValueDict]]
|
||||
]: ...
|
||||
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(
|
||||
self, **kwargs: Any
|
||||
) -> Dict[
|
||||
str, Union[AuthenticationForm, LoginView, str, Site, RequestSite]
|
||||
str, Union[AuthenticationForm, LoginView, Site, RequestSite, str]
|
||||
]: ...
|
||||
|
||||
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
||||
@@ -112,7 +108,7 @@ class PasswordResetConfirmView(PasswordContextMixin, FormView):
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[
|
||||
str, Optional[Union[Dict[Any, Any], MultiValueDict, AbstractBaseUser]]
|
||||
str, Optional[Union[Dict[Any, Any], AbstractBaseUser, MultiValueDict]]
|
||||
]: ...
|
||||
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
@@ -130,10 +126,7 @@ class PasswordChangeView(PasswordContextMixin, FormView):
|
||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[
|
||||
str,
|
||||
Optional[Union[Dict[Any, Any], User, MultiValueDict, SimpleLazyObject]],
|
||||
]: ...
|
||||
) -> Dict[str, Optional[Union[Dict[Any, Any], User, MultiValueDict]]]: ...
|
||||
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
|
||||
|
||||
class PasswordChangeDoneView(PasswordContextMixin, TemplateView):
|
||||
|
||||
0
django-stubs/contrib/contenttypes/__init__.pyi
Normal file
0
django-stubs/contrib/contenttypes/__init__.pyi
Normal file
@@ -42,7 +42,7 @@ class GenericForeignKey(FieldCacheMixin):
|
||||
) -> None: ...
|
||||
def get_filter_kwargs_for_object(
|
||||
self, obj: Model
|
||||
) -> Dict[str, Optional[Union[int, ContentType]]]: ...
|
||||
) -> Dict[str, Optional[ContentType]]: ...
|
||||
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
def get_cache_name(self) -> str: ...
|
||||
@@ -54,12 +54,12 @@ class GenericForeignKey(FieldCacheMixin):
|
||||
) -> ContentType: ...
|
||||
def get_prefetch_queryset(
|
||||
self,
|
||||
instances: Union[QuerySet, List[Model]],
|
||||
instances: Union[List[Model], QuerySet],
|
||||
queryset: Optional[QuerySet] = ...,
|
||||
) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ...
|
||||
def __get__(
|
||||
self, instance: Optional[Model], cls: Type[Model] = ...
|
||||
) -> Optional[Union[Model, GenericForeignKey]]: ...
|
||||
) -> Optional[Union[GenericForeignKey, Model]]: ...
|
||||
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
|
||||
|
||||
class GenericRel(ForeignObjectRel):
|
||||
|
||||
@@ -7,6 +7,7 @@ from django.db import migrations
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.migrations.state import StateApps
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
class RenameContentType(migrations.RunPython):
|
||||
@@ -31,7 +32,7 @@ def inject_rename_contenttypes_operations(
|
||||
) -> None: ...
|
||||
def get_contenttypes_and_models(
|
||||
app_config: AppConfig, using: str, ContentType: Type[ContentType]
|
||||
) -> Tuple[Dict[str, ContentType], Dict]: ...
|
||||
) -> Tuple[Dict[str, ContentType], Dict[str, Type[Model]]]: ...
|
||||
def create_contenttypes(
|
||||
app_config: AppConfig,
|
||||
verbosity: int = ...,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from typing import Any, Optional, Type, Union
|
||||
from typing import Any, Dict, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
|
||||
class ContentTypeManager(models.Manager):
|
||||
@@ -10,11 +11,13 @@ class ContentTypeManager(models.Manager):
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def get_by_natural_key(self, app_label: Any, model: Any): ...
|
||||
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_models(self, *models: Any, for_concrete_models: bool = ...): ...
|
||||
def get_for_models(
|
||||
self, *models: Any, for_concrete_models: bool = ...
|
||||
) -> Dict[Type[Model], ContentType]: ...
|
||||
def get_for_id(self, id: int) -> ContentType: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
|
||||
@@ -30,7 +33,7 @@ class ContentType(models.Model):
|
||||
unique_together: Any = ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
def model_class(self) -> Type[Model]: ...
|
||||
def model_class(self) -> Optional[Type[Model]]: ...
|
||||
def get_object_for_this_type(self, **kwargs: Any) -> Model: ...
|
||||
def get_all_objects_for_this_type(self, **kwargs: Any): ...
|
||||
def natural_key(self): ...
|
||||
def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ...
|
||||
def natural_key(self) -> Tuple[str, str]: ...
|
||||
|
||||
@@ -6,6 +6,6 @@ from django.http.response import HttpResponseRedirect
|
||||
|
||||
def shortcut(
|
||||
request: HttpRequest,
|
||||
content_type_id: Union[str, int],
|
||||
object_id: Union[str, int],
|
||||
content_type_id: Union[int, str],
|
||||
object_id: Union[int, str],
|
||||
) -> HttpResponseRedirect: ...
|
||||
|
||||
0
django-stubs/contrib/flatpages/__init__.pyi
Normal file
0
django-stubs/contrib/flatpages/__init__.pyi
Normal file
@@ -6,12 +6,12 @@ from django.db.models.query import QuerySet
|
||||
|
||||
class FlatpageForm(forms.ModelForm):
|
||||
auto_id: str
|
||||
data: Dict[str, Union[str, List[int]]]
|
||||
data: Dict[str, Union[List[int], str]]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[str, Union[int, str, List[django.contrib.sites.models.Site]]]
|
||||
initial: Dict[str, Union[List[django.contrib.sites.models.Site], int, str]]
|
||||
instance: django.contrib.flatpages.models.FlatPage
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
@@ -20,4 +20,4 @@ class FlatpageForm(forms.ModelForm):
|
||||
model: Any = ...
|
||||
fields: str = ...
|
||||
def clean_url(self) -> str: ...
|
||||
def clean(self) -> Dict[str, Union[str, bool, QuerySet]]: ...
|
||||
def clean(self) -> Dict[str, Union[bool, QuerySet, str]]: ...
|
||||
|
||||
0
django-stubs/contrib/humanize/__init__.pyi
Normal file
0
django-stubs/contrib/humanize/__init__.pyi
Normal file
@@ -11,8 +11,8 @@ def intcomma(
|
||||
|
||||
intword_converters: Any
|
||||
|
||||
def intword(value: Optional[str]) -> Optional[Union[str, int]]: ...
|
||||
def apnumber(value: Optional[str]) -> Optional[Union[str, int]]: ...
|
||||
def intword(value: Optional[str]) -> Optional[Union[int, str]]: ...
|
||||
def apnumber(value: Optional[str]) -> Optional[Union[int, str]]: ...
|
||||
def naturalday(
|
||||
value: Optional[Union[date, str]], arg: None = ...
|
||||
) -> Optional[str]: ...
|
||||
|
||||
0
django-stubs/contrib/messages/__init__.pyi
Normal file
0
django-stubs/contrib/messages/__init__.pyi
Normal file
@@ -14,7 +14,7 @@ def add_message(
|
||||
extra_tags: str = ...,
|
||||
fail_silently: Union[bool, str] = ...,
|
||||
) -> None: ...
|
||||
def get_messages(request: HttpRequest) -> Union[BaseStorage, List[Any]]: ...
|
||||
def get_messages(request: HttpRequest) -> Union[List[Any], BaseStorage]: ...
|
||||
def get_level(request: HttpRequest) -> int: ...
|
||||
def set_level(request: HttpRequest, level: int) -> bool: ...
|
||||
def debug(
|
||||
@@ -45,5 +45,5 @@ def error(
|
||||
request: WSGIRequest,
|
||||
message: str,
|
||||
extra_tags: str = ...,
|
||||
fail_silently: Union[str, bool] = ...,
|
||||
fail_silently: Union[bool, str] = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.contrib.messages.storage.cookie import CookieStorage
|
||||
from django.contrib.messages.storage.fallback import FallbackStorage
|
||||
from django.contrib.messages.storage.session import SessionStorage
|
||||
from django.contrib.messages.storage.base import BaseStorage
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
|
||||
def messages(
|
||||
request: HttpRequest
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Any],
|
||||
Dict[str, int],
|
||||
FallbackStorage,
|
||||
SessionStorage,
|
||||
CookieStorage,
|
||||
],
|
||||
]: ...
|
||||
) -> Dict[str, Union[Dict[str, int], List[Any], BaseStorage]]: ...
|
||||
|
||||
@@ -12,7 +12,7 @@ class Message:
|
||||
def __init__(
|
||||
self, level: int, message: str, extra_tags: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __eq__(self, other: Union[str, Message]) -> bool: ...
|
||||
def __eq__(self, other: Union[Message, str]) -> bool: ...
|
||||
@property
|
||||
def tags(self) -> str: ...
|
||||
@property
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import json
|
||||
from typing import Any, Collection, Dict, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.contrib.messages.storage.base import BaseStorage, Message
|
||||
|
||||
@@ -14,10 +14,42 @@ class MessageEncoder(json.JSONEncoder):
|
||||
skipkeys: bool
|
||||
sort_keys: bool
|
||||
message_key: str = ...
|
||||
def default(self, obj: Message) -> List[Union[str, int]]: ...
|
||||
def default(self, obj: Message) -> List[Union[int, str]]: ...
|
||||
|
||||
class MessageDecoder(json.JSONDecoder):
|
||||
def process_messages(self, obj: Collection) -> Any: ...
|
||||
def process_messages(
|
||||
self,
|
||||
obj: Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[
|
||||
Union[
|
||||
Dict[str, List[Union[int, str]]],
|
||||
List[Union[int, str]],
|
||||
]
|
||||
],
|
||||
List[Union[int, str]],
|
||||
],
|
||||
],
|
||||
List[Union[List[Union[int, str]], str]],
|
||||
str,
|
||||
],
|
||||
) -> Union[
|
||||
Dict[str, Union[List[Union[Dict[str, Message], Message]], Message]],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[List[Union[Dict[str, Message], Message]], Message],
|
||||
],
|
||||
Message,
|
||||
]
|
||||
],
|
||||
List[Union[Message, str]],
|
||||
Message,
|
||||
str,
|
||||
]: ...
|
||||
def decode(
|
||||
self, s: str, **kwargs: Any
|
||||
) -> Union[
|
||||
@@ -25,13 +57,13 @@ class MessageDecoder(json.JSONDecoder):
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[Message, List[Union[Message, Dict[str, Message]]]],
|
||||
Union[List[Union[Dict[str, Message], Message]], Message],
|
||||
],
|
||||
Message,
|
||||
]
|
||||
],
|
||||
Message,
|
||||
List[Union[Message, str]],
|
||||
Message,
|
||||
]: ...
|
||||
|
||||
class CookieStorage(BaseStorage):
|
||||
|
||||
@@ -16,5 +16,5 @@ class SessionStorage(BaseStorage):
|
||||
self, messages: Union[List[Message], List[str]]
|
||||
) -> str: ...
|
||||
def deserialize_messages(
|
||||
self, data: Optional[Union[str, List[Any]]]
|
||||
) -> Optional[Union[List[str], List[Message]]]: ...
|
||||
self, data: Optional[Union[List[Any], str]]
|
||||
) -> Optional[Union[List[Message], List[str]]]: ...
|
||||
|
||||
0
django-stubs/contrib/postgres/__init__.pyi
Normal file
0
django-stubs/contrib/postgres/__init__.pyi
Normal file
3
django-stubs/contrib/postgres/fields/__init__.pyi
Normal file
3
django-stubs/contrib/postgres/fields/__init__.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from .array import * # NOQA
|
||||
from .jsonb import * # NOQA
|
||||
from .ranges import * # NOQA
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.contrib.postgres import lookups
|
||||
from django.db.models import Field, Transform
|
||||
@@ -30,7 +30,11 @@ class ArrayField(CheckFieldDefaultMixin, Field):
|
||||
def get_db_prep_value(
|
||||
self, value: Any, connection: Any, prepared: bool = ...
|
||||
): ...
|
||||
def deconstruct(self) -> Tuple[None, str, List[Any], Dict[str, Any]]: ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Optional[Union[bool, Field]]]
|
||||
]: ...
|
||||
def to_python(self, value: Any): ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def get_transform(self, name: Any): ...
|
||||
|
||||
@@ -35,7 +35,7 @@ class JSONField(CheckFieldDefaultMixin, Field):
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Union[bool, Type[DjangoJSONEncoder]]]
|
||||
None, str, List[Any], Dict[str, Union[Type[DjangoJSONEncoder], bool]]
|
||||
]: ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def get_prep_value(self, value: Any): ...
|
||||
|
||||
0
django-stubs/contrib/redirects/__init__.pyi
Normal file
0
django-stubs/contrib/redirects/__init__.pyi
Normal file
0
django-stubs/contrib/sessions/__init__.pyi
Normal file
0
django-stubs/contrib/sessions/__init__.pyi
Normal file
0
django-stubs/contrib/sessions/backends/__init__.pyi
Normal file
0
django-stubs/contrib/sessions/backends/__init__.pyi
Normal file
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
@@ -16,25 +16,21 @@ class SessionBase:
|
||||
serializer: Any = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: str) -> Union[str, Model, int]: ...
|
||||
def __getitem__(self, key: str) -> Union[Model, int, str]: ...
|
||||
def __setitem__(
|
||||
self, key: str, value: Union[str, datetime, Model, int]
|
||||
self, key: str, value: Union[datetime, Model, int, str]
|
||||
) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def get(
|
||||
self, key: str, default: Optional[str] = ...
|
||||
) -> Optional[Union[str, int, datetime]]: ...
|
||||
def pop(self, key: str, default: Any = ...) -> Union[str, int]: ...
|
||||
) -> Optional[Union[datetime, int, str]]: ...
|
||||
def pop(self, key: str, default: Any = ...) -> Union[int, str]: ...
|
||||
def setdefault(self, key: str, value: str) -> str: ...
|
||||
def set_test_cookie(self) -> None: ...
|
||||
def test_cookie_worked(self) -> bool: ...
|
||||
def delete_test_cookie(self) -> None: ...
|
||||
def encode(
|
||||
self, session_dict: Dict[str, Union[str, int, Model, datetime]]
|
||||
) -> str: ...
|
||||
def decode(
|
||||
self, session_data: Union[str, bytes]
|
||||
) -> Dict[str, Union[str, int, Model, datetime]]: ...
|
||||
def encode(self, session_dict: Dict[str, Model]) -> str: ...
|
||||
def decode(self, session_data: Union[bytes, str]) -> Dict[str, Model]: ...
|
||||
def update(self, dict_: Dict[str, int]) -> None: ...
|
||||
def has_key(self, key: Any): ...
|
||||
def keys(self): ...
|
||||
@@ -45,9 +41,7 @@ class SessionBase:
|
||||
session_key: Any = ...
|
||||
def get_expiry_age(self, **kwargs: Any) -> int: ...
|
||||
def get_expiry_date(self, **kwargs: Any) -> datetime: ...
|
||||
def set_expiry(
|
||||
self, value: Optional[Union[datetime, int, timedelta]]
|
||||
) -> None: ...
|
||||
def set_expiry(self, value: Optional[Union[datetime, int]]) -> None: ...
|
||||
def get_expire_at_browser_close(self) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
def cycle_key(self) -> None: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Type, Union
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
@@ -14,12 +13,12 @@ class SessionStore(SessionBase):
|
||||
@classmethod
|
||||
def get_model_class(cls) -> Type[Session]: ...
|
||||
def model(self) -> Type[AbstractBaseSession]: ...
|
||||
def load(self) -> Dict[str, Union[Model, str, int]]: ...
|
||||
def load(self) -> Dict[str, Union[Model, int, str]]: ...
|
||||
def exists(self, session_key: Optional[str]) -> bool: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def create_model_instance(
|
||||
self, data: Dict[str, Union[int, str, Model, datetime]]
|
||||
self, data: Dict[str, Model]
|
||||
) -> AbstractBaseSession: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
def delete(self, session_key: Optional[str] = ...) -> None: ...
|
||||
|
||||
@@ -9,7 +9,7 @@ class SessionStore(SessionBase):
|
||||
storage_path: str = ...
|
||||
file_prefix: str = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
def load(self) -> Dict[str, Union[str, int]]: ...
|
||||
def load(self) -> Dict[str, Union[int, str]]: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.contrib.sessions.backends.base import SessionBase
|
||||
class SessionStore(SessionBase):
|
||||
accessed: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
def load(self) -> Dict[str, Union[str, datetime]]: ...
|
||||
def load(self) -> Dict[str, Union[datetime, str]]: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
class PickleSerializer:
|
||||
def dumps(self, obj: Dict[str, Union[Model, str, datetime]]) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Union[Model, str, datetime]]: ...
|
||||
def dumps(self, obj: Dict[str, Model]) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Model]: ...
|
||||
|
||||
JSONSerializer = BaseJSONSerializer
|
||||
|
||||
@@ -22,12 +22,10 @@ class Sitemap:
|
||||
def paginator(self) -> Paginator: ...
|
||||
def get_urls(
|
||||
self,
|
||||
page: Union[str, int] = ...,
|
||||
site: Optional[Union[RequestSite, Site]] = ...,
|
||||
page: Union[int, str] = ...,
|
||||
site: Optional[Union[Site, RequestSite]] = ...,
|
||||
protocol: Optional[str] = ...,
|
||||
) -> Union[
|
||||
List[Dict[str, Union[Model, str, datetime, None]]], List[Dict[str, Any]]
|
||||
]: ...
|
||||
) -> List[Dict[str, Optional[Union[datetime, Model, str]]]]: ...
|
||||
|
||||
class GenericSitemap(Sitemap):
|
||||
priority: None = ...
|
||||
@@ -37,7 +35,7 @@ class GenericSitemap(Sitemap):
|
||||
protocol: None = ...
|
||||
def __init__(
|
||||
self,
|
||||
info_dict: Dict[str, Union[QuerySet, datetime, str]],
|
||||
info_dict: Dict[str, Union[datetime, QuerySet, str]],
|
||||
priority: Optional[float] = ...,
|
||||
changefreq: Optional[str] = ...,
|
||||
protocol: Optional[str] = ...,
|
||||
|
||||
0
django-stubs/contrib/sites/__init__.pyi
Normal file
0
django-stubs/contrib/sites/__init__.pyi
Normal file
@@ -7,4 +7,4 @@ from django.http.request import HttpRequest
|
||||
|
||||
def get_current_site(
|
||||
request: Optional[HttpRequest]
|
||||
) -> Union[RequestSite, Site]: ...
|
||||
) -> Union[Site, RequestSite]: ...
|
||||
|
||||
0
django-stubs/contrib/staticfiles/__init__.pyi
Normal file
0
django-stubs/contrib/staticfiles/__init__.pyi
Normal file
@@ -18,7 +18,7 @@ class FileSystemFinder(BaseFinder):
|
||||
self, app_names: None = ..., *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def find_location(
|
||||
self, root: str, path: str, prefix: str = ...
|
||||
) -> Optional[str]: ...
|
||||
@@ -37,7 +37,7 @@ class AppDirectoriesFinder(BaseFinder):
|
||||
def list(
|
||||
self, ignore_patterns: List[str]
|
||||
) -> Iterator[Tuple[str, FileSystemStorage]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def find_in_app(self, app: str, path: str) -> Optional[str]: ...
|
||||
|
||||
class BaseStorageFinder(BaseFinder):
|
||||
@@ -48,7 +48,7 @@ class BaseStorageFinder(BaseFinder):
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def list(
|
||||
self, ignore_patterns: List[str]
|
||||
) -> Iterator[Tuple[str, DefaultStorage]]: ...
|
||||
@@ -57,6 +57,6 @@ class DefaultStorageFinder(BaseStorageFinder):
|
||||
storage: django.contrib.staticfiles.storage.StaticFilesStorage = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
def find(path: str, all: bool = ...) -> Optional[Union[str, List[str]]]: ...
|
||||
def find(path: str, all: bool = ...) -> Optional[Union[List[str], str]]: ...
|
||||
def get_finders() -> Iterator[BaseFinder]: ...
|
||||
def get_finder(import_path: str) -> BaseFinder: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from django.core.files.storage import DefaultStorage, FileSystemStorage
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
|
||||
|
||||
@@ -26,26 +26,17 @@ class Command(BaseCommand):
|
||||
ignore_patterns: Any = ...
|
||||
post_process: Any = ...
|
||||
def set_options(self, **options: Any) -> None: ...
|
||||
def collect(self) -> Union[str, List[str]]: ...
|
||||
def collect(self) -> Dict[str, List[str]]: ...
|
||||
def handle(self, **options: Any) -> Optional[str]: ...
|
||||
def log(self, msg: str, level: int = ...) -> None: ...
|
||||
def is_local_storage(self) -> bool: ...
|
||||
def clear_dir(self, path: str) -> None: ...
|
||||
def delete_file(
|
||||
self,
|
||||
path: str,
|
||||
prefixed_path: str,
|
||||
source_storage: Union[DefaultStorage, FileSystemStorage],
|
||||
self, path: str, prefixed_path: str, source_storage: FileSystemStorage
|
||||
) -> bool: ...
|
||||
def link_file(
|
||||
self,
|
||||
path: str,
|
||||
prefixed_path: str,
|
||||
source_storage: Union[DefaultStorage, FileSystemStorage],
|
||||
self, path: str, prefixed_path: str, source_storage: FileSystemStorage
|
||||
) -> None: ...
|
||||
def copy_file(
|
||||
self,
|
||||
path: str,
|
||||
prefixed_path: str,
|
||||
source_storage: Union[DefaultStorage, FileSystemStorage],
|
||||
self, path: str, prefixed_path: str, source_storage: FileSystemStorage
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.files.storage import DefaultStorage, FileSystemStorage
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
|
||||
def matches_patterns(
|
||||
path: str, patterns: Union[OrderedDict, List[str], Tuple[str]] = ...
|
||||
path: str, patterns: Union[List[str], Tuple[str], OrderedDict] = ...
|
||||
) -> bool: ...
|
||||
def get_files(
|
||||
storage: Union[DefaultStorage, FileSystemStorage],
|
||||
storage: FileSystemStorage,
|
||||
ignore_patterns: List[str] = ...,
|
||||
location: str = ...,
|
||||
) -> Iterator[str]: ...
|
||||
|
||||
0
django-stubs/contrib/syndication/__init__.pyi
Normal file
0
django-stubs/contrib/syndication/__init__.pyi
Normal file
0
django-stubs/core/__init__.pyi
Normal file
0
django-stubs/core/__init__.pyi
Normal file
2
django-stubs/core/cache/__init__.pyi
vendored
2
django-stubs/core/cache/__init__.pyi
vendored
@@ -16,7 +16,7 @@ class CacheHandler:
|
||||
class DefaultCacheProxy:
|
||||
def __getattr__(
|
||||
self, name: str
|
||||
) -> Union[Callable, Dict[str, float], int, OrderedDict]: ...
|
||||
) -> Union[Callable, Dict[str, float], OrderedDict, int]: ...
|
||||
def __setattr__(self, name: str, value: Callable) -> None: ...
|
||||
def __delattr__(self, name: Any): ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
|
||||
0
django-stubs/core/cache/backends/__init__.pyi
vendored
Normal file
0
django-stubs/core/cache/backends/__init__.pyi
vendored
Normal file
17
django-stubs/core/cache/backends/base.pyi
vendored
17
django-stubs/core/cache/backends/base.pyi
vendored
@@ -11,7 +11,7 @@ DEFAULT_TIMEOUT: Any
|
||||
MEMCACHE_MAX_KEY_LENGTH: int
|
||||
|
||||
def default_key_func(
|
||||
key: Union[str, int], key_prefix: str, version: Union[str, int]
|
||||
key: Union[int, str], key_prefix: str, version: Union[int, str]
|
||||
) -> str: ...
|
||||
def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ...
|
||||
|
||||
@@ -22,11 +22,11 @@ class BaseCache:
|
||||
key_func: Callable = ...
|
||||
def __init__(
|
||||
self,
|
||||
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
|
||||
params: Dict[str, Optional[Union[Callable, Dict[str, int], int, str]]],
|
||||
) -> None: ...
|
||||
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
|
||||
def make_key(
|
||||
self, key: Union[str, int], version: Optional[Union[str, int]] = ...
|
||||
self, key: Union[int, str], version: Optional[Union[int, str]] = ...
|
||||
) -> str: ...
|
||||
def add(
|
||||
self,
|
||||
@@ -54,14 +54,14 @@ class BaseCache:
|
||||
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
|
||||
def get_many(
|
||||
self, keys: List[str], version: Optional[int] = ...
|
||||
) -> Dict[str, Union[str, int]]: ...
|
||||
) -> Dict[str, Union[int, str]]: ...
|
||||
def get_or_set(
|
||||
self,
|
||||
key: str,
|
||||
default: Optional[Union[Callable, int, str]],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
) -> Optional[Union[int, str]]: ...
|
||||
def has_key(self, key: Any, version: Optional[Any] = ...): ...
|
||||
def incr(
|
||||
self, key: str, delta: int = ..., version: Optional[int] = ...
|
||||
@@ -73,13 +73,10 @@ class BaseCache:
|
||||
def set_many(
|
||||
self,
|
||||
data: Union[
|
||||
Dict[str, bytes],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
Dict[str, int],
|
||||
OrderedDict,
|
||||
Dict[str, bytes], Dict[str, int], Dict[str, str], OrderedDict
|
||||
],
|
||||
timeout: Any = ...,
|
||||
version: Optional[Union[str, int]] = ...,
|
||||
version: Optional[Union[int, str]] = ...,
|
||||
) -> List[Any]: ...
|
||||
def delete_many(
|
||||
self, keys: Union[Dict[str, str], List[str]], version: None = ...
|
||||
|
||||
6
django-stubs/core/cache/backends/db.pyi
vendored
6
django-stubs/core/cache/backends/db.pyi
vendored
@@ -25,7 +25,7 @@ class BaseDatabaseCache(BaseCache):
|
||||
def __init__(
|
||||
self,
|
||||
table: str,
|
||||
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
|
||||
params: Dict[str, Union[Callable, Dict[str, int], int, str]],
|
||||
) -> None: ...
|
||||
|
||||
class DatabaseCache(BaseDatabaseCache):
|
||||
@@ -36,7 +36,7 @@ class DatabaseCache(BaseDatabaseCache):
|
||||
def get(
|
||||
self,
|
||||
key: str,
|
||||
default: Optional[Union[str, int]] = ...,
|
||||
default: Optional[Union[int, str]] = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Any: ...
|
||||
def set(
|
||||
@@ -49,7 +49,7 @@ class DatabaseCache(BaseDatabaseCache):
|
||||
def add(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[int, bytes, str, Dict[str, int]],
|
||||
value: Union[Dict[str, int], bytes, int, str],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
|
||||
19
django-stubs/core/cache/backends/dummy.pyi
vendored
19
django-stubs/core/cache/backends/dummy.pyi
vendored
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
|
||||
@@ -21,22 +21,7 @@ class DummyCache(BaseCache):
|
||||
def set(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
str,
|
||||
int,
|
||||
List[int],
|
||||
Tuple[int, int, int, int],
|
||||
Dict[str, int],
|
||||
Callable,
|
||||
Type[Any],
|
||||
],
|
||||
],
|
||||
int,
|
||||
],
|
||||
value: Union[Dict[str, Any], int, str],
|
||||
timeout: Any = ...,
|
||||
version: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -12,19 +12,19 @@ class FileBasedCache(BaseCache):
|
||||
def __init__(
|
||||
self,
|
||||
dir: str,
|
||||
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
|
||||
params: Dict[str, Union[Callable, Dict[str, int], int, str]],
|
||||
) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[int, bytes, str, Dict[str, int]],
|
||||
value: Union[Dict[str, int], bytes, int, str],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
def get(
|
||||
self,
|
||||
key: str,
|
||||
default: Optional[Union[str, int]] = ...,
|
||||
default: Optional[Union[int, str]] = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Optional[str]: ...
|
||||
def set(
|
||||
|
||||
15
django-stubs/core/cache/backends/locmem.pyi
vendored
15
django-stubs/core/cache/backends/locmem.pyi
vendored
@@ -1,4 +1,3 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
@@ -12,26 +11,24 @@ class LocMemCache(BaseCache):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
|
||||
params: Dict[str, Optional[Union[Callable, Dict[str, int], int, str]]],
|
||||
) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[
|
||||
Dict[str, Union[str, datetime]], int, bytes, str, Dict[str, int]
|
||||
],
|
||||
value: Union[Dict[str, int], Dict[str, str], bytes, int, str],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Any: ...
|
||||
def get(
|
||||
self,
|
||||
key: Union[str, int],
|
||||
default: Optional[Union[str, int]] = ...,
|
||||
key: Union[int, str],
|
||||
default: Optional[Union[int, str]] = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Any: ...
|
||||
def set(
|
||||
self,
|
||||
key: Union[str, int],
|
||||
key: Union[int, str],
|
||||
value: Any,
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
@@ -41,7 +38,7 @@ class LocMemCache(BaseCache):
|
||||
) -> Any: ...
|
||||
def incr(
|
||||
self,
|
||||
key: Union[str, int],
|
||||
key: Union[int, str],
|
||||
delta: int = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> int: ...
|
||||
|
||||
0
django-stubs/core/checks/__init__.pyi
Normal file
0
django-stubs/core/checks/__init__.pyi
Normal file
@@ -20,7 +20,7 @@ class CheckMessage:
|
||||
obj: Any = ...,
|
||||
id: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def __eq__(self, other: Union[str, CheckMessage]) -> bool: ...
|
||||
def __eq__(self, other: Union[CheckMessage, str]) -> bool: ...
|
||||
def is_serious(self, level: int = ...) -> bool: ...
|
||||
def is_silenced(self) -> bool: ...
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class CheckRegistry:
|
||||
app_configs: Optional[List[AppConfig]] = ...,
|
||||
tags: Optional[List[str]] = ...,
|
||||
include_deployment_checks: bool = ...,
|
||||
) -> Union[List[int], List[CheckMessage], List[str]]: ...
|
||||
) -> Union[List[CheckMessage], List[int], List[str]]: ...
|
||||
def tag_exists(
|
||||
self, tag: str, include_deployment_checks: bool = ...
|
||||
) -> bool: ...
|
||||
|
||||
0
django-stubs/core/checks/security/__init__.pyi
Normal file
0
django-stubs/core/checks/security/__init__.pyi
Normal file
@@ -8,7 +8,7 @@ def check_url_config(
|
||||
app_configs: None, **kwargs: Any
|
||||
) -> List[CheckMessage]: ...
|
||||
def check_resolver(
|
||||
resolver: Union[URLResolver, Tuple[str, Callable], URLPattern]
|
||||
resolver: Union[Tuple[str, Callable], URLPattern, URLResolver]
|
||||
) -> List[CheckMessage]: ...
|
||||
def check_url_namespaces_unique(
|
||||
app_configs: None, **kwargs: Any
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from typing import (Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type,
|
||||
Union)
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.forms.utils import ErrorDict
|
||||
from django.forms.utils import ErrorDict, ErrorList
|
||||
|
||||
|
||||
class FieldDoesNotExist(Exception): ...
|
||||
@@ -35,12 +34,19 @@ class ValidationError(Exception):
|
||||
params: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
message: Iterable,
|
||||
message: Union[
|
||||
Dict[str, List[ValidationError]],
|
||||
Dict[str, ErrorList],
|
||||
List[Union[ValidationError, str]],
|
||||
ValidationError,
|
||||
ErrorList,
|
||||
str,
|
||||
],
|
||||
code: Optional[str] = ...,
|
||||
params: Optional[
|
||||
Union[
|
||||
Dict[str, Union[Tuple[str], Type[Model], Model, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Union[Model, Type[Model], str, Tuple[str]]],
|
||||
]
|
||||
] = ...,
|
||||
) -> None: ...
|
||||
@@ -51,6 +57,6 @@ class ValidationError(Exception):
|
||||
def update_error_dict(
|
||||
self, error_dict: Union[Dict[str, List[ValidationError]], ErrorDict]
|
||||
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
|
||||
def __iter__(self) -> Iterator[Union[str, Tuple[str, List[str]]]]: ...
|
||||
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...
|
||||
|
||||
class EmptyResultSet(Exception): ...
|
||||
|
||||
0
django-stubs/core/files/__init__.pyi
Normal file
0
django-stubs/core/files/__init__.pyi
Normal file
@@ -14,9 +14,9 @@ class File(FileProxyMixin):
|
||||
def size(self) -> int: ...
|
||||
def chunks(
|
||||
self, chunk_size: Optional[int] = ...
|
||||
) -> Iterator[Union[str, bytes]]: ...
|
||||
) -> Iterator[Union[bytes, str]]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[Any] = ...): ...
|
||||
def __iter__(self) -> Iterator[Union[str, bytes]]: ...
|
||||
def __iter__(self) -> Iterator[Union[bytes, str]]: ...
|
||||
def __enter__(self) -> File: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, tb: None) -> None: ...
|
||||
def open(self, mode: Optional[str] = ...) -> File: ...
|
||||
@@ -27,7 +27,7 @@ class ContentFile(File):
|
||||
name: None
|
||||
size: Any = ...
|
||||
def __init__(
|
||||
self, content: Union[str, bytes], name: Optional[str] = ...
|
||||
self, content: Union[bytes, str], name: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def open(self, mode: Optional[str] = ...) -> ContentFile: ...
|
||||
@@ -35,5 +35,5 @@ class ContentFile(File):
|
||||
def write(self, data: str) -> int: ...
|
||||
|
||||
def endswith_cr(line: bytes) -> bool: ...
|
||||
def endswith_lf(line: Union[str, bytes]) -> bool: ...
|
||||
def endswith_lf(line: Union[bytes, str]) -> bool: ...
|
||||
def equals_lf(line: bytes) -> bool: ...
|
||||
|
||||
@@ -14,6 +14,6 @@ class ImageFile(File):
|
||||
def height(self) -> int: ...
|
||||
|
||||
def get_image_dimensions(
|
||||
file_or_path: Union[BytesIO, BufferedReader, str, ImageFile],
|
||||
file_or_path: Union[BufferedReader, BytesIO, ImageFile, str],
|
||||
close: bool = ...,
|
||||
) -> Any: ...
|
||||
|
||||
@@ -13,5 +13,5 @@ class _OFFSET(Structure): ...
|
||||
class _OFFSET_UNION(Union): ...
|
||||
class OVERLAPPED(Structure): ...
|
||||
|
||||
def lock(f: Union[TextIOWrapper, BufferedRandom, int], flags: int) -> bool: ...
|
||||
def lock(f: Union[BufferedRandom, TextIOWrapper, int], flags: int) -> bool: ...
|
||||
def unlock(f: Union[BufferedRandom, int]) -> bool: ...
|
||||
|
||||
@@ -11,7 +11,7 @@ class Storage:
|
||||
def save(
|
||||
self,
|
||||
name: Optional[str],
|
||||
content: Union[TextIOWrapper, StringIO, File],
|
||||
content: Union[StringIO, TextIOWrapper, File],
|
||||
max_length: Optional[int] = ...,
|
||||
) -> str: ...
|
||||
def get_valid_name(self, name: str) -> str: ...
|
||||
|
||||
@@ -13,7 +13,7 @@ class UploadedFile(File):
|
||||
content_type_extra: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
file: Optional[Union[_TemporaryFileWrapper, StringIO, BytesIO]] = ...,
|
||||
file: Optional[Union[BytesIO, StringIO, _TemporaryFileWrapper]] = ...,
|
||||
name: str = ...,
|
||||
content_type: str = ...,
|
||||
size: Optional[int] = ...,
|
||||
@@ -41,7 +41,7 @@ class InMemoryUploadedFile(UploadedFile):
|
||||
field_name: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
file: Union[StringIO, BytesIO],
|
||||
file: Union[BytesIO, StringIO],
|
||||
field_name: Optional[str],
|
||||
name: str,
|
||||
content_type: str,
|
||||
@@ -50,7 +50,7 @@ class InMemoryUploadedFile(UploadedFile):
|
||||
content_type_extra: Optional[Dict[str, bytes]] = ...,
|
||||
) -> None: ...
|
||||
def open(self, mode: Optional[str] = ...) -> InMemoryUploadedFile: ...
|
||||
def chunks(self, chunk_size: None = ...) -> Iterator[Union[str, bytes]]: ...
|
||||
def chunks(self, chunk_size: None = ...) -> Iterator[Union[bytes, str]]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[Any] = ...): ...
|
||||
|
||||
class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
@@ -58,7 +58,7 @@ class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
content: Optional[Union[str, bytes]],
|
||||
content: Optional[Union[bytes, str]],
|
||||
content_type: str = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
|
||||
@@ -26,7 +26,7 @@ class FileUploadHandler:
|
||||
def __init__(self, request: Optional[WSGIRequest] = ...) -> None: ...
|
||||
def handle_raw_input(
|
||||
self,
|
||||
input_data: Union[WSGIRequest, BytesIO],
|
||||
input_data: Union[BytesIO, WSGIRequest],
|
||||
META: Dict[str, Any],
|
||||
content_length: int,
|
||||
boundary: bytes,
|
||||
@@ -68,7 +68,7 @@ class MemoryFileUploadHandler(FileUploadHandler):
|
||||
activated: Any = ...
|
||||
def handle_raw_input(
|
||||
self,
|
||||
input_data: Union[WSGIRequest, BytesIO],
|
||||
input_data: Union[BytesIO, WSGIRequest],
|
||||
META: Dict[str, Any],
|
||||
content_length: int,
|
||||
boundary: bytes,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user