I have a problem with tastypie regarding updates to two models with one (POST) api call.
We have two models, an user model and a candidate model which references the user model. We want to publish the candidate model via the api interface, but want to hide the user model. So, as a first step I merge the user model fields with the candidate model fields in the dehydrate process. This is working completly fine.
The problem is, that I can’t figure out, how to do it the other way round (hydrate and create both models. we need to create a seperate user model and cant just merge both models)
Would be nice if you showed us some code and what have you tried, but for this kind of task you should probably override the
obj_create(...)method oftastypie.resources.ModelResourceclass.It looks like this:
So in your resource you could have something like:
And this should get you started. If you have any trouble, please ask a question and provide some code.