Files
pydantic/docs/examples/ex_post_init_post_parse.py
T
Samuel Colvin e7227db41a Insert prints in docs. (#895)
* starting insert prints

* working exec_script

* remove prints, fix exec_examples.py

* more cleanup of examples, better model printing

* upgrade netlify runtime

* extra docs deps

* few more small tweaks
2019-10-14 16:40:25 +01:00

21 lines
368 B
Python

from datetime import datetime
from pydantic.dataclasses import dataclass
@dataclass
class Birth:
year: int
month: int
day: int
@dataclass
class User:
birth: Birth
def __post_init__(self):
print(self.birth)
def __post_init_post_parse__(self):
print(self.birth)
user = User(**{'birth': {'year': 1995, 'month': 3, 'day': 2}})