How to specify filters for multiple models?

I would like you to teach me with django-drf.
There are django models for rooms, students in rooms, childs, parents of childs.


Class Room(models.model):
    room_cd = models.IntegerField()

Class Student(models.model):
    score = models.IntegerField()
    model_room= models.ForeignKey(Room)
    model_child = models.ForeignKey(Child)

Class Child(models.model):
    child_name = models.CharField()
    model_parent = models.ForeignKey(Parent)

Class Parent(models.model):
    parent_name = models.CharField()

I want to extract the children whose parent is ‘kenny’ in the room ‘a100’.
There may be more than one child.
sql is this.

select * from Room As R
inner join Student  As S on S.model_room = R.id
inner join Child      As C on C.model_student = S.id
inner join Parent    As P on C.model_parent   = P.id
where R.room_cd = 'a100' and P.parent_name = 'kenny'

What would the code look like in django-drf?

If you’re just looking for the ORM representation of that query, you’ll want to review the information at Making queries | Django documentation | Django.

You may also wish to review the docs at Model field reference | Django documentation | Django and Writing your first Django app, part 2 | Django documentation | Django, to learn how to experiment with the ORM to develop the queries you need for your application.

If this isn’t the issue, we’re going to need to have you be more specific as to what it is you are looking for assistance in resolving.