The complete view is here: http://dpaste.com/122227/
On Feb 18, 11:46 am, May <adles...@gmail.com> wrote: > Hello Karen, > > Here are my views and models: > > http://dpaste.com/122204/ > > http://dpaste.com/122224/ > > The manytomany table is actually a tertiary table. I was just trying > to use django terms, so people would understand what type of table. > > Thanks for your help! > > May > > On Feb 18, 11:33 am, Karen Tracey <kmtra...@gmail.com> wrote: > > > On Wed, Feb 18, 2009 at 1:43 PM, May <adles...@gmail.com> wrote: > > > > I need to get the institution name through an intermediary table (two > > > foreign keys) to display in a template. > > > > The code is here: > > > >http://dpaste.com/122204/ > > > > Thank you anyone, > > > (Your subject line says manytomany but I don't see any evidence of > > ManyToMany relations in the page you point to, there you just mention > > ForeignKeys?) > > > Your view passes in a results variable to your template where you have: > > > {% for project in results %} > > {{Project.contact|safe}} > > {{Contact.institutionname|safe}} # the institutionname (isn't retrieving)... > > {% endfor %} > > > First, I don't see how the {{Project..}} bit can be working since you've got > > a case mismatch on the leading 'p' between {% for project ... %} and {{ > > Project...}} > > > Second, {{ Contact...}} won't be resolving to anything because you don't > > have any variable named Contact. Perhaps you want: > > > {{ project.contact.institution }} > > > or > > > {{ project.contact.institution.institutionname }} > > > it's a little hard to tell because you didn't actually include your model > > definitions. If it's just following foreign keys to get to the field you > > want, though, it's quite easy to do using the dot notation if you know the > > right field names. > > > Karen > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---