I would suggest reading this: https://docs.djangoproject.com/en/1.7/topics/db/queries/#lookups-that-span-relationships
and see if that helps out. You can span relationships (in this case, using FK's) using the double-underscore notation. I would also check out using select_related() if you would like to keep the number of queries to a minimum. The description of how to use select_related() also includes an example that spans 3 models, which I think is what you are looking for (although you didn't specify whether one model contains the other two FK's, or if you are jumping through one model via an FK to another model FK): https://docs.djangoproject.com/en/1.7/ref/models/querysets/#select-related -James On Thu, Feb 19, 2015 at 9:44 PM, sum abiut <suab...@gmail.com> wrote: > Hi, > I have three models that i want to extract data from them. The models are > join using foreign key. i am not sure how to do that in django. Can someone > please point me to the right path. > > Cheers > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAPCf-y7vVA995WHrStKebFOBLQXx9gnu%2B-c0TwaK70uFNA-ZqA%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAPCf-y7vVA995WHrStKebFOBLQXx9gnu%2B-c0TwaK70uFNA-ZqA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXXZmQKp607PO-3jtBN6O%2B5YdOCF3FbTUk8ch5m%3DTDtoA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.