Elektrine lite

← Feed

@adamghill@indieweb.social

Post #3253746

2026-04-15 14:42 UTC

@josh@social.joshthomas.dev @webology@mastodon.social there are a few projects which mash Pydantic into the Django ORM -- I haven't used any in prod, though. I like Pydantic just fine, but personally all I want is is better DX for Django models and I don't see why Pydantic is required for that at all. I have a proof-of-concept which is "just" a base class (or decorator) which wraps around a normal Django model, but adds support for types hints. However, as is typical, I got distracted and haven't finished the last 10%.

Replies (1)

  • @webology@mastodon.social 2026-04-15 14:58

    @adamghill@indieweb.social @josh@social.joshthomas.dev The reason some of us try to inject Pydantic into everything is that a BaseModel is a better starting point than Python's Object or even a vanilla Python class. So giving it a Python dict or JSON gets you a lot for free, and it's easy to validate and serialize. The magic for me is giving it dates in random formats and yet it always does the right thing with them. 90% of the time, I'm just using simple Python types and it just works.

    Open ##3253747