Hi David,

Not sure what you mean by "parent object". If author is a ForeignKey
in your blog_entry model, and author has a field called full_name,
then you should be able to use {{ blog_entry.author.full_name }}.

Otherwise, you could just place author in the context that's passed to
your templates.

    blog_entry = ... # get blog entry
    author = ... # get author
    t = loader.get_template('blog/detail.html')
    c = Context({
        'blog_entry': blog_entry,
        'author': author,
    })
    return HttpResponse(t.render(c))

Hope this helps.

Bryan


On 8/13/06, mediumgrade <[EMAIL PROTECTED]> wrote:
> I have a simple blog app that I am working on. In this app, I have
> ojects for  each entry as well as the author who wrote it. I wrote a
> simple view which displays a list of all entrys made, but I want that
> list to include the name of the author. Since the author's name is not
> part of the entry, how do I access attributes from related objects
> within a template?

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

Reply via email to