django-rest-framework

Django Rest Framework Nested Serializers

这一生的挚爱 提交于 2020-08-25 07:45:31
问题 I am currently having trouble executing two layered nesting with Django rest framework. I have read the DRF docs with nested relationships here http://www.django-rest-framework.org/api-guide/relations/ and have successfully done the first layer which is to show styles with many colors in JSON. Not sure how to chain another layer though. Any help would be appreciated. Thanks in advance! The current output looks like this: [{ "name": "AAA123", "colors": [ { "name": "White" } ] }, { "name":