As an example, say I'm building a blogging app, and I want a right
sidebar that always shows the last X post titles. What's the best way
to template this?

I've though of something like the following in a base.html:

<div id="sidebar">
{% block sidebar %}
{% last_posts_list %}
{% endblock %}
</div>

Where 'last_posts_list' is a templatestag that I write myself. Then
all my real pages that inherit from base.html will get that
dynamically generated content in the sidebar.

Somehow though, that solution feels a bit too "heavy". I'm a Python
programmer by trade, so I don't mind having to write a custom template
tag, but I keep seeing all this talk of non-programmers doing
wonderful things very easily, so it feels like I'm missing something
basic here.

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. I guess that the 'include' tag would do
that, but then I'd need to explicitly pass the required sidebar
context into every template, right?

Thanks,
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