Comments (3)
Nah. That's not a good idea to use mode="json" since we may want to use callable(s) in settings. So probably the only viable solution is to include all known types from pydantic_core and modify to_django
so it can handle additional types conversions.
from pydjantic.
So probably the only viable solution is to include all known types from pydantic_core and modify to_django so it can handle additional types conversions.
Do I understand correctly that you're suggesting adding custom handlers for non-standard Pydantic types (like Url
, NameEmail
, etc.), similar to how we handle SecretStr
and SecretBytes
here?
pydjantic/pydjantic/pydjantic.py
Lines 55 to 56 in 0a98139
If that's the case, I have no objections. It seems like a logical development for the library, and I'd be grateful if you could create the appropriate patch to address your issue.
In turn, I’ll promptly review it and release a new version to PyPI!
from pydjantic.
Yeah. Unfortunately I haven't found any better solution other than handling custom types manually within 'to_django' function. It's not nice but there is no better way to do it at the moment.
from pydjantic.
Related Issues (10)
- feat: manage.py command to generate .env HOT 4
- Support conn_max_age & ssl_require in BaseDBConfig HOT 6
- Improve failure output HOT 3
- SecretStr and SecretBytes values are not respected HOT 2
- Support python3.8 HOT 1
- bug in test_exact(): change BaseSettings to BaseDBConfig
- Type support HOT 4
- Pydantic serializer warnings, such as "Expected `multi-host-url` but got `dict` - serialized value may not be as expected" HOT 4
- How to handle different environments HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pydjantic.