add Model.__init__ typechecking

This commit is contained in:
Maxim Kurnikov
2019-02-08 17:16:03 +03:00
parent dead370244
commit 916df1efb6
16 changed files with 359 additions and 108 deletions

View File

@@ -1,20 +1,17 @@
import datetime
from typing import Any, Dict, List, Optional, Union
from typing import Any, Optional, Union
from uuid import UUID
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.db.models.base import Model
from django.db import models
ADDITION: int
CHANGE: int
DELETION: int
ACTION_FLAG_CHOICES: Any
class LogEntryManager(models.Manager):
creation_counter: int
model: None
name: None
use_in_migrations: bool = ...
def log_action(
self,
user_id: int,
@@ -22,23 +19,18 @@ class LogEntryManager(models.Manager):
object_id: Union[int, str, UUID],
object_repr: str,
action_flag: int,
change_message: Union[
Dict[str, Dict[str, List[str]]], List[Dict[str, Dict[str, Union[List[str], str]]]], str
] = ...,
change_message: Any = ...,
) -> LogEntry: ...
class LogEntry(models.Model):
content_type_id: int
id: None
user_id: int
action_time: datetime.datetime = ...
user: Any = ...
content_type: Any = ...
object_id: str = ...
object_repr: str = ...
action_flag: int = ...
change_message: str = ...
objects: Any = ...
action_time: models.DateTimeField = ...
user: models.ForeignKey = ...
content_type: models.ForeignKey[ContentType] = ...
object_id: models.TextField = ...
object_repr: models.CharField = ...
action_flag: models.PositiveSmallIntegerField = ...
change_message: models.TextField = ...
objects: LogEntryManager = ...
def is_addition(self) -> bool: ...
def is_change(self) -> bool: ...
def is_deletion(self) -> bool: ...