On 5/17/06, Adam <[EMAIL PROTECTED]> wrote:
>
> > It feels like I should be able to define a template just for the
> > sidebar, and insert the content of that template into whatever
> > template is being rendered.
>
> The way I look at it, that's pretty much what you're doing if you write
> a custom inclusion tag:
>
> ---------- custom tag file ----------
> @register.inclusion_tag('blog/sidebar.html')
> def last_posts_list():
>     posts = Post.objects.all()[:10] # or whatever
>     return {'posts': posts}
>
> ---------- blog/sidebar.html ----------
> {% for post in posts %}
>     {{ post.title }}
> {% endfor %}
>
>

I'm not seeing 'inclusion_tag' in the docs anywhere, is it meant to be
a public API function?

Jay P.

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