I'm not sure I understand exactly what the problem is. The post you
cite seems to have the exact solution you are looking for. I
appreciate that you don't want to violate DRY, but pretty much every
Django view I've written ends with render_to_response. In your
situation you just give the "templates/%(site_profile_name)s/
template.html" % blah as the first element in the list and you're
away. Presumably "template.html" is dependent on the view.

If you're looking for the themes the ProDjango book gives a pretty
good example of doing that, so that might be what you're looking for.

Euan


On 9 July, 02:59, zenWeasel <thebuddas...@gmail.com> wrote:
> I have what I think is a common issue, but I have not seen a good
> solution. I have tried various workarounds and got nowhere. So, here
> what I would like to do and the problem I run into.
>
> I want to have a template loader that looks for templates based upon a
> user's current "site_profile", which is basically a version of what
> site they are on. So I need the loader to look in:
>
> templates/site_profile_name/template.html and return a 404 if it
> doesn't exist.
>
> Someone earlier had linked 
> tohttp://www.b-list.org/weblog/2007/nov/01/django-tips-template-loading...
> but none of these really apply as they are at the view level and this
> is not practical as I would need to make each and every view do a
> select_template() for the site_profile string. A template loader seems
> like a much more DRY approach. However I have to admit that, despite
> hours of staring, I find the template loader code a little baffling.
>
> The Django docs make a reference (in not recommending the
> threads_local method) to calling a method/function that has access to
> Request. But what would that be? I'm clearly not making some important
> connection.
>
> Thanks for any insight.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to