You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My apologies if this is covered in the docs somewhere and I missed it. Is it possible to have a Nested schema that refers to properties of the parent model object?
Assume you have a model that looks something like this:
But there's no "meta" attribute on the ORM object, I just want to pull out specific properties. Is there a way to tell the Nested schema that it should look for values on the parent?
A guess a more general way to phrase this question would be: How can Marshmallow handle situations where the relationships between model objects is different that the relationships in the serialized output? Should I just be coercing it into the necessary shape with @post_dump and @pre_load modifiers?
The text was updated successfully, but these errors were encountered:
My apologies if this is covered in the docs somewhere and I missed it. Is it possible to have a Nested schema that refers to properties of the parent model object?
Assume you have a model that looks something like this:
And you want to produce serialized output like:
If you define marshmallow schemas like:
But there's no "meta" attribute on the ORM object, I just want to pull out specific properties. Is there a way to tell the Nested schema that it should look for values on the parent?
A guess a more general way to phrase this question would be: How can Marshmallow handle situations where the relationships between model objects is different that the relationships in the serialized output? Should I just be coercing it into the necessary shape with
@post_dump
and@pre_load
modifiers?The text was updated successfully, but these errors were encountered: