divide docs in sections, provide Meta attributes inheritance, add tests for fastapi use wih mixins and concrete

This commit is contained in:
collerek
2020-12-11 15:51:29 +01:00
10 changed files with 328 additions and 69 deletions

View File

@ -72,6 +72,8 @@ class NewBaseModel(
# noinspection PyMissingConstructor
def __init__(self, *args: Any, **kwargs: Any) -> None: # type: ignore
if self.Meta.abstract:
raise ModelError(f"You cannot initialize abstract model {self.get_name()}")
object.__setattr__(self, "_orm_id", uuid.uuid4().hex)
object.__setattr__(self, "_orm_saved", False)
object.__setattr__(self, "_pk_column", None)