I found a way to work around this, but it's still bugging me that it  
doesn't work this way.


On Jun 16, 2006, at 12:48 AM, Andrew Gwozdziewycz wrote:

> I'm trying to build a system, which uses generic views, inherited  
> templates and template tags.
>
> 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
> [EMAIL PROTECTED]
> http://23excuses.com | http://ihadagreatview.org | http://and.rovir.us
>
>

---
Andrew Gwozdziewycz
[EMAIL PROTECTED]
http://23excuses.com | http://ihadagreatview.org | http://and.rovir.us



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

Reply via email to