The example is this:
1. generic view uses "entry_detail.html"
2. entry_detail extends "content.html"
3. "content.html" loads a template tag library called
content_utility, and
a tag {% get_conten_sectiont %} is used.
do_get_content_section is the registered function and it
just creates a ContentNode which has an empty constructor.
3a. Assuming render is called, ContentNode issues 1 query
and adds the results into the current context.
3b. Blocks are conditionally created to override defaults
in "base.html"
4. It seems though that render is never getting called, and thus
ContentNode never issues the query, which never
adds the results to the context, and hence nothing happens.
class ContentSectionNode(template.Node):
def __init__(self):
pass
def render(self, context):
if not context.has_key('request'):
return ''
request = context['request']
if not page_re.match(request.path):
tmp = request.path.split('?')[0]
if tmp[0] == '/' and tmp[-1] == '/' and len(tmp) >= 2:
tmp = tmp[1:-1]
context['content_section'] = Page.objects.filter
(path=tmp)
return ''
def do_get_content_section(parser, token):
return ContentSectionNode()
register.tag('get_content_section', do_get_content_section)
//
{% load content_utility %}
{% get_content_section %}
Anybody have any ideas as to what might be causing this problem?
---
Andrew Gwozdziewycz
apg...@gmail.com
http://23excuses.com | http://ihadagreatview.org | http://and.rovir.us