mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 13:04:47 +08:00
83 lines
2.7 KiB
Python
83 lines
2.7 KiB
Python
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
|
|
|
|
from django.db.migrations.operations.base import Operation
|
|
from django.db.models.indexes import Index
|
|
from django.db.models.manager import Manager
|
|
|
|
from django.db.models.fields import Field
|
|
|
|
class ModelOperation(Operation):
|
|
name: str = ...
|
|
def __init__(self, name: str) -> None: ...
|
|
def name_lower(self) -> str: ...
|
|
|
|
class CreateModel(ModelOperation):
|
|
serialization_expand_args: Any = ...
|
|
fields: Any = ...
|
|
options: Any = ...
|
|
bases: Any = ...
|
|
managers: Any = ...
|
|
def __init__(
|
|
self,
|
|
name: str,
|
|
fields: List[Tuple[str, Field]],
|
|
options: Optional[Dict[str, Any]] = ...,
|
|
bases: Optional[Union[Tuple[Type[Any], ...], Tuple[str, ...]]] = ...,
|
|
managers: Optional[List[Tuple[str, Manager]]] = ...,
|
|
) -> None: ...
|
|
def model_to_key(self, model: str) -> List[str]: ...
|
|
|
|
class DeleteModel(ModelOperation): ...
|
|
|
|
class RenameModel(ModelOperation):
|
|
old_name: Any = ...
|
|
new_name: Any = ...
|
|
def __init__(self, old_name: str, new_name: str) -> None: ...
|
|
def old_name_lower(self) -> str: ...
|
|
def new_name_lower(self) -> str: ...
|
|
|
|
class AlterModelTable(ModelOperation):
|
|
table: Optional[str] = ...
|
|
def __init__(self, name: str, table: Optional[str]) -> None: ...
|
|
|
|
class ModelOptionOperation(ModelOperation): ...
|
|
class FieldRelatedOptionOperation(ModelOptionOperation): ...
|
|
|
|
class AlterUniqueTogether(FieldRelatedOptionOperation):
|
|
option_name: str = ...
|
|
unique_together: Any = ...
|
|
def __init__(self, name: str, unique_together: Set[Tuple[str, ...]]) -> None: ...
|
|
|
|
class AlterIndexTogether(FieldRelatedOptionOperation):
|
|
option_name: str = ...
|
|
index_together: Set[Tuple[str, ...]] = ...
|
|
def __init__(self, name: str, index_together: Set[Tuple[str, ...]]) -> None: ...
|
|
|
|
class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
|
|
order_with_respect_to: str = ...
|
|
def __init__(self, name: str, order_with_respect_to: str) -> None: ...
|
|
|
|
class AlterModelOptions(ModelOptionOperation):
|
|
ALTER_OPTION_KEYS: Any = ...
|
|
options: Dict[str, str] = ...
|
|
def __init__(self, name: str, options: Dict[str, Any]) -> None: ...
|
|
|
|
class AlterModelManagers(ModelOptionOperation):
|
|
serialization_expand_args: Any = ...
|
|
managers: Any = ...
|
|
def __init__(self, name: Any, managers: Any) -> None: ...
|
|
|
|
class IndexOperation(Operation):
|
|
option_name: str = ...
|
|
def model_name_lower(self): ...
|
|
|
|
class AddIndex(IndexOperation):
|
|
model_name: str = ...
|
|
index: Index = ...
|
|
def __init__(self, model_name: str, index: Index) -> None: ...
|
|
|
|
class RemoveIndex(IndexOperation):
|
|
model_name: str = ...
|
|
name: str = ...
|
|
def __init__(self, model_name: str, name: str) -> None: ...
|