Hi Russ.

{% decorate (either "a.html" or "b.html") %}

This isn't actual syntax; it's just trying to communicate that the
subtemplate (not the base), can extend either a.html or b.html.  It
would be implemented by {% decorate base_template %}, where
base_template is a context variable.  This is commonly done with the
{% extends %} tag already.  The base template is absolutely not
referencing the names of the templates that descend from it; that
would be silly as you point out.

On May 3, 10:25 am, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> On Fri, Apr 29, 2011 at 4:48 PM, Jonathan Slenders
>
>
>
>
>
>
>
>
>
> <jonathan.slend...@gmail.com> wrote:
> > Hey, this pattern are nested decorators in templates.
>
> > Most people here are probably against having nested template tags with
> > the same name. I think it does only make sense when there's somehow a
> > distinction between a
> > "placeholder" and "content". Because otherwise, templates don't know
> > which block in the parent template need to be chosen when several have
> > the same name. (You'd say the most inner block, but that's not obvious
> > -- I think.)
>
> > I once wrote a {% decorate %} template tag for a little similar
> > behaviour.
> >https://github.com/citylive/django-template-tags/blob/master/src/djan...
>
> > That would become:
>
> > template.html:
> > {% decorate (either "a.html" or "b.html") %}
> > middle
> > {% enddecorate %}
>
> > b.html:
> > {% decorate "a.html" %}
> > left {{ decorator.content }} right
> > {% enddecorate %}
>
> > a.html:
> > first {{ decorator.content }} last
>
> > Hope that helps.
> > I once tried to get this into django trunk, but did not yet got
> > accepted.
>
> For me, this:
>
> > {% decorate (either "a.html" or "b.html") %}
>
> is enough of a reason to reject this proposal -- I fundamentally have
> no idea what this is trying to say, or why it's trying to say it this
> way. Why does a base template need to reference the names of the
> templates that descend from it? For me, this is completely bass
> ackwards.
>
> I'm also slightly confused as to why your proposal isn't already covered by:
>
> template.html
> {% block decorated %}
> middle
> {% endblock %}
>
> a.html
> {% extends template.html %}
> {% block decorated %}left {{ block.super }} right{% endblock %}
>
> b.html
> {% extends template.html %}
> {% block decorated %}first {{ block.super }} last{% endblock %}

This isn't the problem I'm trying to solve.  template.html extends
from a.html / b.html, not the other way around.  My original post
shows that the problem is different to this, I think.


>
> Yours,
> Russ Magee %-)

Thanks for checking this out :)

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

Reply via email to