Django Rest Framework with self nested serializers

163 views
Skip to first unread message

Sencer Hamarat

unread,
Apr 26, 2022, 4:13:20 PM4/26/22
to django...@googlegroups.com
Hello people,

There are two models that are related to each other.

class Parent(models.Model):
    name = models.CharField...

class Child(models.Model):
    parent = models.ForeignKey(Parent)
    value = models.CharField...

And there is a serializer built on "Child" model:

class ChildSerializer(serializers.ModelSerializer):
    class Meta:
        model = Child

What I need is getting all Child objects related with Parent object via ChildSerializer

What should I do to achieve to the solution?
Reply all
Reply to author
Forward
0 new messages