django-ninja
django-ninja copied to clipboard
[BUG] @model_validator(mode="before") issue
Describe the bug
When using something like this, values
is a DjangoGetter
instance which is somewhat unexpected to me. Prior to 1.0 and the pydantic update you would get a plain dictionary.
class SomeSchema(Schema):
somevar:int
@model_validator(mode="before")
@classmethod
def foo(cls, values):
values.get("something")
Versions (please complete the following information):
- Python version: 3.10
- Django version: 4.1
- Django-Ninja version: 1.0.1
- Pydantic version: 2.5.1
Note to myself: maybe adding dict methods to DjangoGetter will work
Hey @vitalik, any word on this? We're trying to upgrade to 1.1.0 and blocked by this. Thinking of submitting a PR depending on complex it is.