jerber / MagicDB

MIT License
3 stars 1 forks source link

Add default factory datetimes for DateModel last_updated and created_at #8

Closed jerber closed 4 years ago

jerber commented 4 years ago

class Model(BaseModel): uid: UUID = Field(default_factory=uuid4) updated: datetime = Field(default_factory=datetime.utcnow)

https://pydantic-docs.helpmanual.io/usage/models/#orm-mode-aka-arbitrary-class-instances

jerber commented 4 years ago

done