I used a base.html template and extends it with a String-Template.
Example:
----------------------------------------------------------
from django.template import Template, Context #, loader

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


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to