AltSchool / dynamic-rest

Dynamic extensions for Django REST Framework
MIT License
820 stars 107 forks source link

Create/Update FK bad behavior #356

Open threewordphrase opened 11 months ago

threewordphrase commented 11 months ago

I've been using this package for along time. I love it forlist and get endpoints. However I am extremely disappointed with the create/update behavior to the point where I am considering abandoning it.

When I create or update a record, for example updating a Store object that has a relationship to a Manager, I need to POST/PATCH this:

{"manager": 1}

Instead of this:

{"manager_id": 1}

The response from the update/create is also incorrect. It returns an object containing 'manager_id': 3, 'manager': 3. I did not pass any include params (the manager field is deferred) so I would expect to only get the manager_id field. And if I do get the manager field, I certainly do not want it to be the FK. That's the manager_id field.

How can I make this consistent?