[Fixed]-Django Rest Framework not working with simple nested serializer

1👍

From the structure of your models, a BookDetail object can have more than one Addon instances, since, Addon model have a foreign key to BookDetail.

If you want to have more than one Addons for a particular BookDetail, you cant update the Addon instance without using a list.

But, if its not the case, then I would recommend using a OneToOne relation instead of Foreign Key.
Actually, its pretty ugly using a OneToOne field, rather you can just add the fields into your parent model(BookDetail), which can be defaulted to null, if there is None.

Leave a comment