skip polymorphic in pydantic v1
This commit is contained in:
parent
5d1bf5c2f3
commit
d0d0288797
@ -539,6 +539,7 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
|
|||||||
config_kwargs = {
|
config_kwargs = {
|
||||||
key: kwargs[key] for key in kwargs.keys() & allowed_config_kwargs
|
key: kwargs[key] for key in kwargs.keys() & allowed_config_kwargs
|
||||||
}
|
}
|
||||||
|
if IS_PYDANTIC_V2:
|
||||||
base_fields = {}
|
base_fields = {}
|
||||||
base_annotations = {}
|
base_annotations = {}
|
||||||
for base in bases[::-1]:
|
for base in bases[::-1]:
|
||||||
@ -551,9 +552,8 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
|
|||||||
base_annotations.update(dict_used["__annotations__"])
|
base_annotations.update(dict_used["__annotations__"])
|
||||||
dict_used["__annotations__"] = base_annotations
|
dict_used["__annotations__"] = base_annotations
|
||||||
base_fields.update(dict_used)
|
base_fields.update(dict_used)
|
||||||
new_cls = super().__new__(
|
dict_used = base_fields
|
||||||
cls, name, bases, base_fields, **config_kwargs
|
new_cls = super().__new__(cls, name, bases, dict_used, **config_kwargs)
|
||||||
)
|
|
||||||
new_cls.__annotations__ = {
|
new_cls.__annotations__ = {
|
||||||
**relationship_annotations,
|
**relationship_annotations,
|
||||||
**pydantic_annotations,
|
**pydantic_annotations,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user