Re: Extending templates dynamically

2011-05-06 Thread Marty Alchin
On Fri, May 6, 2011 at 12:25 PM, Christophe Pettus  wrote:
> Steal from the best! :)  One additional feature that they added was a dynamic 
> way of doing {{ extends }}.  Rather than specifying the tag in the template 
> source, the inheritance path can be specified directly in the 
> render-equivalent call.  This has proven to be quite useful for those times 
> that an inner template is used in multiple wrapper contexts.  Is this 
> something that might be worth investigating in Django?  Looking at the Django 
> source, the implementation seems quite straight-forward.

Does the current behavior of {% extends %} not do what you want?

http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#extends

In particular, note that you can supply any template variable as the
argument to {% extends %} in order to dynamically inherit from
whatever template your view decides is appropriate. That said, if you
have questions about using {% extends %} in this way, it's probably
best to take it to django-users instead.

-Marty

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Extending templates dynamically

2011-05-06 Thread Christophe Pettus
Having had to do some PHP programming for the first time in a long time, I 
discovered that the Smarty template language has taken Django's template 
inheritance mechanism and adopted it wholesale in version 3:

http://www.smarty.net/docs/en/advanced.features.template.inheritance.tpl

Steal from the best! :)  One additional feature that they added was a dynamic 
way of doing {{ extends }}.  Rather than specifying the tag in the template 
source, the inheritance path can be specified directly in the render-equivalent 
call.  This has proven to be quite useful for those times that an inner 
template is used in multiple wrapper contexts.  Is this something that might be 
worth investigating in Django?  Looking at the Django source, the 
implementation seems quite straight-forward.

--
-- Christophe Pettus
   x...@thebuild.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.