mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 00:07:09 +08:00
* Support returning the correct values for the different QuerySet methods when using .values() and .values_list(). * Fix slicing on QuerySet. Fix django queries test, and remove some ignored errors that are no longer needed. * Remove accidental change in RawQuerySet. * Readded some still-necessary ignores to aggregation django test. * Add more tests of first/last/earliest/last/__getitem__, per mkurnikov's comments. - Fix .iterator() * Re-add Iterator as base-class of QuerySet. * Make QuerySet a Collection. * - Fix return type for QuerySet.select_for_update(). - Use correct return type for QuerySet.dates() / QuerySet.datetimes(). - Use correct type params in return type for QuerySet.__and__ / QuerySet.__or__ - Re-add Sized as base class for QuerySet. - Add test of .all() for all _Row types. - Add test of .get() for all _Row types. - Remove some redundant QuerySet method tests. * Automatically fill in second type parameter for QuerySet. ... if second parameter is omitted.
43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar
|
|
|
|
from django.db.models.base import Model
|
|
from django.db.models.query import QuerySet
|
|
|
|
_T = TypeVar("_T", bound=Model, covariant=True)
|
|
|
|
class BaseManager(QuerySet[_T, _T]):
|
|
creation_counter: int = ...
|
|
auto_created: bool = ...
|
|
use_in_migrations: bool = ...
|
|
def __new__(cls: Type[BaseManager], *args: Any, **kwargs: Any) -> BaseManager: ...
|
|
model: Optional[Any] = ...
|
|
name: Optional[Any] = ...
|
|
def __init__(self) -> None: ...
|
|
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
|
|
def check(self, **kwargs: Any) -> List[Any]: ...
|
|
@classmethod
|
|
def from_queryset(cls, queryset_class: Type[QuerySet], class_name: Optional[str] = ...) -> Any: ...
|
|
@classmethod
|
|
def _get_queryset_methods(cls, queryset_class: type) -> Dict[str, Any]: ...
|
|
def contribute_to_class(self, model: Type[Model], name: str) -> None: ...
|
|
def db_manager(self, using: Optional[str] = ..., hints: Optional[Dict[str, Model]] = ...) -> Manager: ...
|
|
def get_queryset(self) -> QuerySet[_T, _T]: ...
|
|
|
|
class Manager(BaseManager[_T]): ...
|
|
|
|
class RelatedManager(Manager[_T]):
|
|
def add(self, *objs: Model, bulk: bool = ...) -> None: ...
|
|
def clear(self) -> None: ...
|
|
|
|
class ManagerDescriptor:
|
|
manager: Manager = ...
|
|
def __init__(self, manager: Manager) -> None: ...
|
|
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Manager: ...
|
|
|
|
class EmptyManager(Manager):
|
|
creation_counter: int
|
|
name: None
|
|
model: Optional[Type[Model]] = ...
|
|
def __init__(self, model: Type[Model]) -> None: ...
|
|
def get_queryset(self) -> QuerySet: ...
|