Allow custom model config

This commit is contained in:
Joshua Kifer
2021-07-24 11:43:48 -07:00
parent 9bf2bdf00e
commit 29761999e7
2 changed files with 23 additions and 1 deletions

View File

@ -552,7 +552,13 @@ class ModelMetaclass(pydantic.main.ModelMetaclass):
:param attrs: class namespace
:type attrs: Dict
"""
attrs["Config"] = get_pydantic_base_orm_config()
if "Config" in attrs:
class Config(attrs["Config"], get_pydantic_base_orm_config()):
pass
attrs["Config"] = Config
else:
attrs["Config"] = get_pydantic_base_orm_config()
attrs["__name__"] = name
attrs, model_fields = extract_annotations_and_default_vals(attrs)
for base in reversed(bases):