Files
pydantic/docs/examples/dynamic_model_creation.py
T
Samuel Colvin f9cf6b42f4 Create model method (#125)
* adding create_model method

* adding  method

* docs and tweaks

* prevent config and base together

* tweak docs
2018-02-06 14:29:56 +00:00

9 lines
197 B
Python

from pydantic import BaseModel, create_model
DynamicFoobarModel = create_model('DynamicFoobarModel', foo=(str, ...), bar=123)
class StaticFoobarModel(BaseModel):
foo: str
bar: int = 123