djantic2
djantic2 copied to clipboard
Pydantic model support for Django
To ensure that we are staying backwards compatible to 2.0.0 and everything still works for the latest version of pydantic.
Thanks for this fork! I was bummed to see Djantic abandoned(ish), then thrilled to see your issue posted there about this fork. I always "watch" the releases on a repo...
``` Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__ return await self.app(scope, receive,...
I test this peace of code and I noticed that the field_validator does not work properly, never execute the field_validator function. ```python from djantic import ModelSchema from pydantic import field_validator...
For Djantic2 we need `model_config = ConfigDict(model = ... , include = ....)` pycharm flags this with a warning that model and include are not expected. I think something needs...
Could we specify models using strings, and have it lazily evaluated ? It might make it a little easier to avoid circular imports.
I went to fix this one line, and just saw some other stuff that might be a useful contribution so I added it.
Added overloads to the from_django() signature to inform type checkers that the function returns a ModelSchema if many=False and a list[ModelSchema] otherwise.