On Tuesday 30 June 2009 14:13:15 russelson wrote:
> #models.py
>
> class House(models.Model):
>     name = models.CharField(blank=True, max_length=50)
>
> class People(models.Model):
>     name = models.CharField(blank=True, max_length=50)
>     house = models.ForegnKey(House)
>
> #views.py
> def house_list(request):
>         houses = House.objects.all()
>         return render_to_response('test/house_list.html', {'object_list':
> houses})
>
> #house_list.html
> {% for object in object_list %}
>     {{ object.name }}
>     {{ object.people.name }}           #!?!?
> {% endfor %}
>
> How do i retrieve the information in the People model?

object.people_set.all() will give you the list of people in the house
-- 
regards
kg
http://lawgon.livejournal.com

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to