Thats' because by default Django will name the field "model_set" on the 
reverse relationship. So if you want to access it that way, you should 
do entry.updates_set.all(). A nicer, more readable way, is to set 
related_name on the ForeignKey. E.g: entry = models.ForeignKey(Entry, 
related_name="updates") (This is a field in your Updates model)

Hope this helps!

--
Ollie
> I have an app that I'm building and I've run into a problem. I have 2
> models "Entries" and "Updates" which points to "Entries" with a
> ForeignKey. The idea is that an entry can be updated at multiple times
> and I track the date and other meta information of the update within
> the update model.
>
> When I try and create the detail template I can't seem to find a way
> to list the updates for an entry. Here is the code I am trying to use:
>
> {% for update in entry.updates.all %}
> <h1>{{update.body}}</h1>
> {% endfor %}
>
> sadly this has no effect.. Any help would be much appriciated :)
>
>
> >   


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

Reply via email to