Welcome to the Treehouse Community
Looking to learn something new?
How to get objects of model one in model two form which are linked with one to many relationship? In Django
I am having two models Patient and Ipd, both are having different unique id and both are created using Forms , First form creates patient object and I want to create Ipd Form which is linked to Patient with patient id with one to many relationship i.e one patient can have multiple Ipd , I not getting how to get patient objects in Ipd Form and create ipd Object which are linked to Patient , I hope you will understant my problem
Can you post your model code? Do you have a foreign key setup? Typically I would have that setup on the primary side which in this case would be the Patient.