I'm totally confused over how Django uses ORM relationships when listing out data. Let's use the "writing your first app" though I think it's not a very good example. Okay, in the models we have some fields: Poll.question Choice.poll (foreign key) Choice.choice Choice.votes
So in a view you can specify a list of choices - let's say rpt_list = Choice.objects.all(). Now in a template suppose you want a list with the following: Choice, Poll Question, Votes Can I do something like {% for temp in rpt_list %} <td>{{temp.choice}}</td> <td>{{temp.choice.poll.question}}</td> ???? can you refer to related objects in this manner ??? <td>{{temp.votes}}</td> or do we always have to pass in a dictionary of the parent (Poll) ie p = Poll.objects.filter(id=2) then in template use something like : % for temp in p.choice_set.all %} ??? where does "choice_set" come from ? - is it automatically created from the ORM ? Does it automatically create a set of choices that relate to the Poll object specified ? Honestly, the official tutorial needs to be re-written. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---