I have some object with Pydantic's class. I have to create dict from object.
from enum import Enum
from pydantic import BaseModel
class StatusId(Enum):
ACTIVE: int = 1
PASSIVE: int = 2
class Pamagite(BaseModel):
status_id: StatusId = StatusId.ACTIVE
another_field: str = "another_field"
If I try do like this:
pamagite = Pamagite().dict()
I will get
pamagite = {'status_id': <StatusId.ACTIVE: 1>, 'another_field': 'another_field'}
I expected that pamagite will be equally to
pamagite = {'status_id': 1, 'another_field': 'another_field'}
How I can do this?