Multi table association

23 views
Skip to first unread message

Sanjay S Nair

unread,
Jul 20, 2017, 1:46:48 PM7/20/17
to Django REST framework
Hello All

I don't have much experiece on DRF.

I have:
1. A table with 5 fields(char)
2. another table with set of fields.
3. An association table which has a pk, fk of first table, fk of second table

How do I fetch the data using the DRF from the 3rd table, which has only the foreign keys.

And after I fetch these, how to include this serialized data with another parent serialized data?

Sanjay S Nair

unread,
Jul 20, 2017, 1:54:50 PM7/20/17
to Django REST framework

Table1 Table2 Table3
id id id
fld fk_table1 fld
fld fk_table3 fld
fld
fld
fld
fld
fld
fld


I have written the serialization for table 1. It is able to fetch the table 1 data. But I also want to fetch the data from table 3 as well based on the matching keys from table 2.

Thanks for the help
Reply all
Reply to author
Forward
0 new messages