my_example_string_template = """
{% extends "example.html" %}
blabla...
"""
c = Context(context)
t = Template(my_example_string_template)
html = t.render(c)
return HttpResponse(html)
----------------------------------------------------------
So i need only to import this:
from django.template import Template, Context
and not django.template.loader.
If i don't import the loader i get the error:
----------------------------------------------------------
Traceback (most recent call last):
File "test2.py", line 8, in ?
t = Template(my_example_string_template)
File "./django/template/__init__.py", line 158, in __init__
File "./django/template/__init__.py", line 174, in compile_string
File "./django/template/__init__.py", line 271, in parse
File "./django/template/__init__.py", line 315, in invalid_block_tag
django.template.TemplateSyntaxError: Invalid block tag: 'extends'
----------------------------------------------------------
This is normal. Because django.template.loader makes this:
add_to_builtins('django.template.loader_tags')
and the tags 'block', 'extends' and 'include' are defined in
django.template.loader_tags
conclusion: The loader must be import, even if i not use it directly!
Is that not somehow stupidly solved?
--
Mfg.
Jens Diemer
----
CMS in pure Python CGI: http://www.pylucid.org
Amazing you should post this ... I was just about to do the same!
(I just ran across this error tonight, and was typing up a message
to the list)
--
Mike Cuddy (mcu...@FensEnde.com), Programmer, Baritone, Daddy, Human.
Fen's Ende Software, Redwood City, CA, USA, Earth, Sol System, Milky Way.
"The problem with defending the purity of the English language is
that English is about as pure as a cribhouse whore. We don't just
borrow words; on occasion, English has pursued other languages down
alleyways to beat them unconscious and rifle their pockets for new
vocabulary." -- James D. Nicoll
Join CAUCE: The Coalition Against Unsolicited Commercial E-mail.
<http://www.cauce.org/>