diff --git a/docs/fastapi.md b/docs/fastapi.md index 2bf7645..9efdde8 100644 --- a/docs/fastapi.md +++ b/docs/fastapi.md @@ -58,7 +58,7 @@ async def shutdown() -> None: Define ormar models with appropriate fields. -Those models will be used insted of pydantic ones. +Those models will be used instead of pydantic ones. ```python class Category(ormar.Model): @@ -210,4 +210,4 @@ def test_all_endpoints(): [fastapi]: https://fastapi.tiangolo.com/ [models]: ./models/index.md [database initialization]: ./models/migrations.md -[tests]: https://github.com/collerek/ormar/tree/master/tests \ No newline at end of file +[tests]: https://github.com/collerek/ormar/tree/master/tests diff --git a/ormar/__init__.py b/ormar/__init__.py index 4868e8f..5dbf884 100644 --- a/ormar/__init__.py +++ b/ormar/__init__.py @@ -68,7 +68,7 @@ class UndefinedType: # pragma no cover Undefined = UndefinedType() -__version__ = "0.9.4" +__version__ = "0.9.5" __all__ = [ "Integer", "BigInteger", diff --git a/ormar/fields/base.py b/ormar/fields/base.py index 1fada90..1b5f7a6 100644 --- a/ormar/fields/base.py +++ b/ormar/fields/base.py @@ -1,3 +1,4 @@ +import inspect from typing import Any, List, Optional, TYPE_CHECKING, Type, Union import sqlalchemy diff --git a/ormar/fields/foreign_key.py b/ormar/fields/foreign_key.py index 65a9df0..da20325 100644 --- a/ormar/fields/foreign_key.py +++ b/ormar/fields/foreign_key.py @@ -73,7 +73,9 @@ def create_dummy_model( "".join(choices(string.ascii_uppercase, k=2)) + uuid.uuid4().hex[:4] ).lower() fields = {f"{pk_field.name}": (pk_field.__type__, None)} + dummy_model = create_model( # type: ignore + f"PkOnly{base_model.get_name(lower=False)}{alias}", __module__=base_model.__module__, **fields, # type: ignore diff --git a/ormar/models/helpers/pydantic.py b/ormar/models/helpers/pydantic.py index 5797598..60646f8 100644 --- a/ormar/models/helpers/pydantic.py +++ b/ormar/models/helpers/pydantic.py @@ -98,7 +98,7 @@ def populate_pydantic_default_values(attrs: Dict) -> Tuple[Dict, Dict]: BaseField class. Trigger conversion of ormar field into pydantic FieldInfo, which has all needed - paramaters saved. + parameters saved. Overwrites the annotations of ormar fields to corresponding types declared on ormar fields (constructed dynamically for relations). diff --git a/setup.py b/setup.py index 2c5c25b..a37f0b8 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,8 @@ setup( description="A simple async ORM with fastapi in mind and pydantic validation.", long_description=get_long_description(), long_description_content_type="text/markdown", - keywords=['orm', 'sqlalchemy', 'fastapi', 'pydantic', 'databases', 'async', 'alembic'], + keywords=['orm', 'sqlalchemy', 'fastapi', 'pydantic', 'databases', 'async', + 'alembic'], author="Radosław Drążkiewicz", author_email="collerek@gmail.com", packages=get_packages(PACKAGE),