mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 08:17:08 +08:00
* Broaden type annotation for verbose_name(_plural) to accept lazystr. Fixes #1137. Signed-off-by: Zixuan James Li <p359101898@gmail.com> * Broaden type annotation for help_text to accept lazystr. Signed-off-by: Zixuan James Li <p359101898@gmail.com> * Broaden type annotation for ValidationError to accept lazystr. Signed-off-by: Zixuan James Li <p359101898@gmail.com> * Broaden type annotation for label to accept lazystr. Signed-off-by: Zixuan James Li <p359101898@gmail.com> * Add StrPromise and StrOrPromise aliases to django_stubs_ext. We make StrPromise and StrOrPromise available via django_stubs_ext so that conditional imports with TYPE_CHECKING is not required. These aliases fall back to Promise or Union[str, Promise] when not TYPE_CHECKING. Signed-off-by: Zixuan James Li <p359101898@gmail.com> Signed-off-by: Zixuan James Li <p359101898@gmail.com>
26 lines
928 B
Python
26 lines
928 B
Python
import types
|
|
from typing import Dict, Iterator, Optional, Type
|
|
|
|
from django.apps.registry import Apps
|
|
from django.db.models.base import Model
|
|
from django.utils.functional import _StrOrPromise
|
|
|
|
MODELS_MODULE_NAME: str
|
|
|
|
class AppConfig:
|
|
name: str = ...
|
|
module: Optional[types.ModuleType] = ...
|
|
apps: Optional[Apps] = ...
|
|
label: str = ...
|
|
verbose_name: _StrOrPromise = ...
|
|
path: str = ...
|
|
models_module: Optional[str] = ...
|
|
models: Dict[str, Type[Model]] = ...
|
|
def __init__(self, app_name: str, app_module: Optional[types.ModuleType]) -> None: ...
|
|
@classmethod
|
|
def create(cls, entry: str) -> AppConfig: ...
|
|
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
|
|
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[Type[Model]]: ...
|
|
def import_models(self) -> None: ...
|
|
def ready(self) -> None: ...
|