[Django]-Django REST Framework — is multiple nested serialization possible?

4👍

Multiple nested serialization works for me. The only major difference is that I specify a related_name for the FK relationships. So try doing this:

class Item(models.Model):
    container = models.ForeignKey(Container, related_name='items')

class ItemSetting(models.Model):
    item = models.ForeignKey(Item, related_name='settings')

Hope this works for you.

👤AdelaN

Leave a comment