Monday, October 25, 2010

Re: Embed the file system path to a template??

On Tue, Oct 26, 2010 at 1:05 AM, Joakim Hove <joakim.hove@gmail.com> wrote:
>
>> However, if you just want to know the top-level template that started
>> the rendering process, you could obtain this by writing a custom
>> render_to_template() shortcut that inserts the loaded template name
>> into the context.
>
> Thank you,
>
>  I considered writing this custom render_to_template() shortcut, but
> hoped maybe there was a simpler solution. I will be using this custom
> shortcut quite extensively - i.e. I would like existing code which
> currently calls render_to_response() to change over to my new shortcut
> without updating every call. Is there a reasonably elegant way to
> achieve this?

An *elegant* way? Not that I can think of. To alter existing uses of
render_to_response you would need to get into monkeypatching, which is
never a good option :-)

Yours,
Russ Magee %-)

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment