I've been banging my head against this problem for several days now, and have decided to ask for help. I've read the Django DB API and searched this mailing list.
Assuming the following models: http://dpaste.com/82218/ What I would like to do is access the 'study_level' field. When my view is called, I will know the Agency name, and I'd like to show a list of documents that correspond to that agency. Generic views allow me to quite easily do this, but what I can't seem to do is access the information in agency_docs. When I print out each document, I'd like to put the 'study_level' information beside each. I though that 'select_related' would be my answer, because as far as I can tell, I need to do a classic JOIN. However, I've tried: >>> a = Agency.objects.get(name='Agency1') >>> d = a.documents.select_related().all() >>> d[0].agency_docs.study_level but I get the 'has no attribute 'agency_docs' error. I believe I've tried every conceivable combination, I've stuck _set onto the ends of things, I'm completely frustrated. Any help would be greatly appreciated. Kind regards, Robert --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

