mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 04:34:29 +08:00
add NullBooleanField, cleanups
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
|
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
|
||||||
|
|
||||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
|
||||||
from django.db.migrations.operations.base import Operation
|
from django.db.migrations.operations.base import Operation
|
||||||
from django.db.migrations.state import ProjectState
|
|
||||||
from django.db.models.fields import Field
|
|
||||||
from django.db.models.indexes import Index
|
from django.db.models.indexes import Index
|
||||||
from django.db.models.manager import Manager
|
from django.db.models.manager import Manager
|
||||||
|
|
||||||
|
from django.db.models.fields import Field
|
||||||
|
|
||||||
class ModelOperation(Operation):
|
class ModelOperation(Operation):
|
||||||
name: Any = ...
|
name: str = ...
|
||||||
def __init__(self, name: str) -> None: ...
|
def __init__(self, name: str) -> None: ...
|
||||||
def name_lower(self) -> str: ...
|
def name_lower(self) -> str: ...
|
||||||
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
|
|
||||||
def reduce(self, operation: Operation, in_between: List[Operation], app_label: str = ...) -> bool: ...
|
|
||||||
|
|
||||||
class CreateModel(ModelOperation):
|
class CreateModel(ModelOperation):
|
||||||
serialization_expand_args: Any = ...
|
serialization_expand_args: Any = ...
|
||||||
@@ -28,27 +25,9 @@ class CreateModel(ModelOperation):
|
|||||||
bases: Optional[Union[Tuple[Type[Any], ...], Tuple[str, ...]]] = ...,
|
bases: Optional[Union[Tuple[Type[Any], ...], Tuple[str, ...]]] = ...,
|
||||||
managers: Optional[List[Tuple[str, Manager]]] = ...,
|
managers: Optional[List[Tuple[str, Manager]]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[Dict[str, str], List[Tuple[str, Field]], str]]]: ...
|
|
||||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
|
||||||
def database_forwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def database_backwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def describe(self) -> str: ...
|
|
||||||
def model_to_key(self, model: str) -> List[str]: ...
|
def model_to_key(self, model: str) -> List[str]: ...
|
||||||
|
|
||||||
class DeleteModel(ModelOperation):
|
class DeleteModel(ModelOperation): ...
|
||||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
|
|
||||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
|
||||||
def database_forwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def database_backwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def describe(self) -> str: ...
|
|
||||||
|
|
||||||
class RenameModel(ModelOperation):
|
class RenameModel(ModelOperation):
|
||||||
old_name: Any = ...
|
old_name: Any = ...
|
||||||
@@ -56,81 +35,37 @@ class RenameModel(ModelOperation):
|
|||||||
def __init__(self, old_name: str, new_name: str) -> None: ...
|
def __init__(self, old_name: str, new_name: str) -> None: ...
|
||||||
def old_name_lower(self) -> str: ...
|
def old_name_lower(self) -> str: ...
|
||||||
def new_name_lower(self) -> str: ...
|
def new_name_lower(self) -> str: ...
|
||||||
def deconstruct(self): ...
|
|
||||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
|
||||||
def database_forwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def database_backwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|
||||||
class AlterModelTable(ModelOperation):
|
class AlterModelTable(ModelOperation):
|
||||||
table: Any = ...
|
table: Optional[str] = ...
|
||||||
def __init__(self, name: str, table: Optional[str]) -> None: ...
|
def __init__(self, name: str, table: Optional[str]) -> None: ...
|
||||||
def deconstruct(self): ...
|
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any): ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|
||||||
class ModelOptionOperation(ModelOperation): ...
|
class ModelOptionOperation(ModelOperation): ...
|
||||||
|
class FieldRelatedOptionOperation(ModelOptionOperation): ...
|
||||||
class FieldRelatedOptionOperation(ModelOptionOperation):
|
|
||||||
def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ...
|
|
||||||
|
|
||||||
class AlterUniqueTogether(FieldRelatedOptionOperation):
|
class AlterUniqueTogether(FieldRelatedOptionOperation):
|
||||||
option_name: str = ...
|
option_name: str = ...
|
||||||
unique_together: Any = ...
|
unique_together: Any = ...
|
||||||
def __init__(self, name: str, unique_together: Set[Tuple[str, ...]]) -> None: ...
|
def __init__(self, name: str, unique_together: Set[Tuple[str, ...]]) -> None: ...
|
||||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[Set[Tuple[str, str]], str]]]: ...
|
|
||||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
|
||||||
def database_forwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def database_backwards(
|
|
||||||
self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
|
||||||
) -> None: ...
|
|
||||||
def describe(self) -> str: ...
|
|
||||||
|
|
||||||
class AlterIndexTogether(FieldRelatedOptionOperation):
|
class AlterIndexTogether(FieldRelatedOptionOperation):
|
||||||
option_name: str = ...
|
option_name: str = ...
|
||||||
index_together: Any = ...
|
index_together: Set[Tuple[str, ...]] = ...
|
||||||
def __init__(self, name: str, index_together: Set[Tuple[str, str]]) -> None: ...
|
def __init__(self, name: str, index_together: Set[Tuple[str, ...]]) -> None: ...
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any): ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|
||||||
class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
|
class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
|
||||||
order_with_respect_to: str = ...
|
order_with_respect_to: str = ...
|
||||||
def __init__(self, name: str, order_with_respect_to: str) -> None: ...
|
def __init__(self, name: str, order_with_respect_to: str) -> None: ...
|
||||||
def deconstruct(self): ...
|
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|
||||||
class AlterModelOptions(ModelOptionOperation):
|
class AlterModelOptions(ModelOptionOperation):
|
||||||
ALTER_OPTION_KEYS: Any = ...
|
ALTER_OPTION_KEYS: Any = ...
|
||||||
options: Any = ...
|
options: Dict[str, str] = ...
|
||||||
def __init__(self, name: str, options: Dict[str, str]) -> None: ...
|
def __init__(self, name: str, options: Dict[str, str]) -> None: ...
|
||||||
def deconstruct(self): ...
|
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|
||||||
class AlterModelManagers(ModelOptionOperation):
|
class AlterModelManagers(ModelOptionOperation):
|
||||||
serialization_expand_args: Any = ...
|
serialization_expand_args: Any = ...
|
||||||
managers: Any = ...
|
managers: Any = ...
|
||||||
def __init__(self, name: Any, managers: Any) -> None: ...
|
def __init__(self, name: Any, managers: Any) -> None: ...
|
||||||
def deconstruct(self): ...
|
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|
||||||
class IndexOperation(Operation):
|
class IndexOperation(Operation):
|
||||||
option_name: str = ...
|
option_name: str = ...
|
||||||
@@ -140,18 +75,8 @@ class AddIndex(IndexOperation):
|
|||||||
model_name: str = ...
|
model_name: str = ...
|
||||||
index: Index = ...
|
index: Index = ...
|
||||||
def __init__(self, model_name: str, index: Index) -> None: ...
|
def __init__(self, model_name: str, index: Index) -> None: ...
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def deconstruct(self): ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|
||||||
class RemoveIndex(IndexOperation):
|
class RemoveIndex(IndexOperation):
|
||||||
model_name: str = ...
|
model_name: str = ...
|
||||||
name: str = ...
|
name: str = ...
|
||||||
def __init__(self, model_name: str, name: str) -> None: ...
|
def __init__(self, model_name: str, name: str) -> None: ...
|
||||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
|
||||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
|
||||||
def deconstruct(self): ...
|
|
||||||
def describe(self): ...
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from .fields import (
|
|||||||
SlugField as SlugField,
|
SlugField as SlugField,
|
||||||
TextField as TextField,
|
TextField as TextField,
|
||||||
BooleanField as BooleanField,
|
BooleanField as BooleanField,
|
||||||
|
NullBooleanField as NullBooleanField,
|
||||||
FileField as FileField,
|
FileField as FileField,
|
||||||
DateField as DateField,
|
DateField as DateField,
|
||||||
DateTimeField as DateTimeField,
|
DateTimeField as DateTimeField,
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ class BooleanField(Field):
|
|||||||
def __set__(self, instance, value: bool) -> None: ...
|
def __set__(self, instance, value: bool) -> None: ...
|
||||||
def __get__(self, instance, owner) -> bool: ...
|
def __get__(self, instance, owner) -> bool: ...
|
||||||
|
|
||||||
|
class NullBooleanField(BooleanField):
|
||||||
|
def __set__(self, instance, value: Optional[bool]) -> None: ...
|
||||||
|
def __get__(self, instance, owner) -> Optional[bool]: ...
|
||||||
|
|
||||||
class FileField(Field): ...
|
class FileField(Field): ...
|
||||||
class IPAddressField(Field): ...
|
class IPAddressField(Field): ...
|
||||||
|
|
||||||
|
|||||||
52
django-stubs/views/debug.pyi
Normal file
52
django-stubs/views/debug.pyi
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
from typing import Any, Callable, Dict, List, Optional, Type, Union
|
||||||
|
|
||||||
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
|
from django.http.request import QueryDict
|
||||||
|
from django.http.response import Http404, HttpResponse
|
||||||
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
|
DEBUG_ENGINE: Any
|
||||||
|
HIDDEN_SETTINGS: Any
|
||||||
|
CLEANSED_SUBSTITUTE: str
|
||||||
|
CURRENT_DIR: Any
|
||||||
|
|
||||||
|
class CallableSettingWrapper:
|
||||||
|
def __init__(self, callable_setting: Union[Callable, Type[Any]]) -> None: ...
|
||||||
|
|
||||||
|
def cleanse_setting(key: Union[int, str], value: Any) -> Any: ...
|
||||||
|
def get_safe_settings() -> Dict[str, Any]: ...
|
||||||
|
def technical_500_response(request: Any, exc_type: Any, exc_value: Any, tb: Any, status_code: int = ...): ...
|
||||||
|
def get_default_exception_reporter_filter() -> SafeExceptionReporterFilter: ...
|
||||||
|
def get_exception_reporter_filter(request: Optional[WSGIRequest]) -> SafeExceptionReporterFilter: ...
|
||||||
|
|
||||||
|
class ExceptionReporterFilter:
|
||||||
|
def get_post_parameters(self, request: Any): ...
|
||||||
|
def get_traceback_frame_variables(self, request: Any, tb_frame: Any): ...
|
||||||
|
|
||||||
|
class SafeExceptionReporterFilter(ExceptionReporterFilter):
|
||||||
|
def is_active(self, request: Optional[WSGIRequest]) -> bool: ...
|
||||||
|
def get_cleansed_multivaluedict(self, request: WSGIRequest, multivaluedict: QueryDict) -> QueryDict: ...
|
||||||
|
def get_post_parameters(self, request: Optional[WSGIRequest]) -> Union[Dict[Any, Any], QueryDict]: ...
|
||||||
|
def cleanse_special_types(self, request: Optional[WSGIRequest], value: Any) -> Any: ...
|
||||||
|
def get_traceback_frame_variables(self, request: Any, tb_frame: Any): ...
|
||||||
|
|
||||||
|
class ExceptionReporter:
|
||||||
|
request: Optional[django.core.handlers.wsgi.WSGIRequest] = ...
|
||||||
|
filter: django.views.debug.SafeExceptionReporterFilter = ...
|
||||||
|
exc_type: None = ...
|
||||||
|
exc_value: Optional[str] = ...
|
||||||
|
tb: None = ...
|
||||||
|
is_email: bool = ...
|
||||||
|
template_info: None = ...
|
||||||
|
template_does_not_exist: bool = ...
|
||||||
|
postmortem: None = ...
|
||||||
|
def __init__(
|
||||||
|
self, request: Optional[WSGIRequest], exc_type: None, exc_value: Optional[str], tb: None, is_email: bool = ...
|
||||||
|
) -> None: ...
|
||||||
|
def get_traceback_data(self) -> Dict[str, Any]: ...
|
||||||
|
def get_traceback_html(self) -> SafeText: ...
|
||||||
|
def get_traceback_text(self) -> SafeText: ...
|
||||||
|
def get_traceback_frames(self) -> List[Any]: ...
|
||||||
|
|
||||||
|
def technical_404_response(request: WSGIRequest, exception: Http404) -> HttpResponse: ...
|
||||||
|
def default_urlconf(request: WSGIRequest) -> HttpResponse: ...
|
||||||
Reference in New Issue
Block a user