Thursday, August 25, 2011

find_template Django 1.3

Hello,

In Django 1.3 templates work a little different, in particular,
`find_template` returns compiled Template object, not template source.
There is a ticket here https://code.djangoproject.com/ticket/15102 but
last entry is 4 months old and I can't tell from discussion whether in
future Django will allow to get template source, or not.

So, can I somehow get template source with 1.3, and will Django allow
me get template source in the future?

Why I need it, my use case. I used it to send emails:

1. Get template source;
2. Prepend source by some additional template tags/filter, like "{%
load my_template_utils %}", so these tags/filters could be used
without explicitly adding them into each template;
3. Append footer, the same for all emails;
4. Render composed template and send email.

I know, this could be rewritten without getting template source, but I
think it will be less convenient for template authors.

Thank you.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate