I'm building a CMS system in django, and in the admin I need to be
able to inspect a template to see what nodes it contains.
(specifically, I'm searching for a custom template tag related to the
CMS)
Using
from django.template.loader import get_template
t = get_template("test.html")
print t.nodelist
gives me a list of TextNodes etc as expected for basic templates, but
when I try it on a template that extends another template, all I get
is the ExtendsNode in my list, ie
[<ExtendsNode: extends "base.html">]
I'm assuming this is a feature, not a bug, and is due to lazy loading
or something along those lines — my question is how do I work out what
nodes the final rendered template will have? I'd like to do this
without having to render the template if possible, as I don't want to
have to fake a RequestContext. I've tried looking in the source code
to no avail - can anyone point me in the right direction?
Thanks,
Greg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---