remove date dumping to isoformat, add pydantic 1.9 support

This commit is contained in:
collerek
2022-01-03 18:23:22 +01:00
parent 14b30baf40
commit aab46de800
7 changed files with 193 additions and 160 deletions

View File

@ -20,7 +20,6 @@ except ImportError: # pragma: no cover
import pydantic
from pydantic.class_validators import make_generic_validator
from pydantic.fields import ModelField, SHAPE_LIST
from pydantic.main import SchemaExtraCallable
import ormar # noqa: I100, I202
from ormar.models.helpers.models import meta_field_not_set
@ -249,7 +248,7 @@ def overwrite_binary_format(schema: Dict[str, Any], model: Type["Model"]) -> Non
]
def construct_modify_schema_function(fields_with_choices: List) -> SchemaExtraCallable:
def construct_modify_schema_function(fields_with_choices: List) -> Callable:
"""
Modifies the schema to include fields with choices validator.
Those fields will be displayed in schema as Enum types with available choices
@ -275,7 +274,7 @@ def construct_modify_schema_function(fields_with_choices: List) -> SchemaExtraCa
return staticmethod(schema_extra) # type: ignore
def construct_schema_function_without_choices() -> SchemaExtraCallable:
def construct_schema_function_without_choices() -> Callable:
"""
Modifies model example and description if needed.

View File

@ -76,7 +76,6 @@ class NewBaseModel(pydantic.BaseModel, ModelTableProxy, metaclass=ModelMetaclass
pk: Any
__model_fields__: Dict[str, BaseField]
__table__: sqlalchemy.Table
__fields__: Dict[str, pydantic.fields.ModelField]
__pydantic_model__: Type[BaseModel]
__pkname__: str
__tablename__: str