[BUG] Two reproducible issues in DRF nested serializers with many to many t…
…hrough model
Note: Before submitting this pull request, please review our contributing guidelines.
Description
I have found two issues when working on a nested serializer with many to many with through model. The first one is related on how APIClient prepare the request with nested json using multipart/form-data which is not passed as json to request.data, so in this case the serializer raises, complaining about missing items which is actually passed. The second one is related on how to_representation is called which is raising an attribute error. Any help to find the root cause of these two issues would be much appreciated.
I managed to fix the to_representation issue by specifying the source parameter on the many to many serializer but there is still an issue on the default json encoding.
@auvipy I believe there is a problem with APIClient but I didn't dig further into it so I can't point precisely what is causing the issue. The many to many serializer issue does not appear as long as the source parameter is specified, I think the documentation should be clear about it. I'll be happy to rename the test app to something else, if you have any preference let me know.