Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Template inheritance and {% include %} tags
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Elsdörfer  
View profile  
 More options Sep 18 2008, 1:39 pm
From: Michael Elsdörfer <elsdoer...@gmail.com>
Date: Thu, 18 Sep 2008 10:39:05 -0700 (PDT)
Local: Thurs, Sep 18 2008 1:39 pm
Subject: Template inheritance and {% include %} tags
I remember this coming up on django-users and IRC once or twice, and
never thought too much about it, but currently, template inheritance
and includes don't work together at all:

* Blocks included in a parent template cannot be overwritten in a
child template.
* Blocks from an include in a child template cannot overwrite blocks
in a parent template.

Now that I was in a situation myself were this would have been handy,
I wonder why that doesn't (shouldn't?) work: It turns out that
changing ConstantIncudeNode to expose ``make self.template.nodelist``
as ``self.nodelist`` is all that is necessary (tests still pass).
Granted, for dynamic includes it is probably harder or possibly even
undoable (I haven't looked into that), but why not enable it for the
presumable prevalent use case (static includes)?

Am I overlooking something, or was there just no demand so far?

Related tickets: #7321 (invalid), possibly: #6646 (design decision
needed).

Michael


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Willison  
View profile  
 More options Sep 18 2008, 5:17 pm
From: Simon Willison <si...@simonwillison.net>
Date: Thu, 18 Sep 2008 14:17:28 -0700 (PDT)
Local: Thurs, Sep 18 2008 5:17 pm
Subject: Re: Template inheritance and {% include %} tags
On Sep 18, 6:39 pm, Michael  Elsdörfer <elsdoer...@gmail.com> wrote:

> I remember this coming up on django-users and IRC once or twice, and
> never thought too much about it, but currently, template inheritance
> and includes don't work together at all:

> * Blocks included in a parent template cannot be overwritten in a
> child template.
> * Blocks from an include in a child template cannot overwrite blocks
> in a parent template.

I've got a workaround for that which works pretty well:

http://code.djangoproject.com/wiki/ExtendingTemplates

Cheers,

Simon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Elsdörfer  
View profile  
 More options Sep 18 2008, 6:37 pm
From: Michael Elsdörfer <elsdoer...@gmail.com>
Date: Thu, 18 Sep 2008 15:37:00 -0700 (PDT)
Subject: Re: Template inheritance and {% include %} tags

> I've got a workaround for that which works pretty well:

> http://code.djangoproject.com/wiki/ExtendingTemplates

Hm I might be misunderstanding, but it seems you're trying to
workaround the situation where two templates might not be uniquely
addressable. I can't quite make the connection to the issue I was
referring to (the fact that block-tags inside a template that was
included using {% include %} are ignored by the inheritance-
mechanism).

Michael


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SmileyChris  
View profile  
 More options Sep 18 2008, 6:58 pm
From: SmileyChris <smileych...@gmail.com>
Date: Thu, 18 Sep 2008 15:58:21 -0700 (PDT)
Local: Thurs, Sep 18 2008 6:58 pm
Subject: Re: Template inheritance and {% include %} tags

On Sep 19, 9:17 am, Simon Willison <si...@simonwillison.net> wrote:

I think you missed the point, Simon.

Michael isn't talking about self-referencing extending, he's talking
about blocks in statically included templates ({% include "bit.htm"
%}).

I can't see a reason why at least static blocks shouldn't be exposed
as self.nodelist


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Willison  
View profile  
 More options Sep 19 2008, 4:42 am
From: Simon Willison <si...@simonwillison.net>
Date: Fri, 19 Sep 2008 01:42:32 -0700 (PDT)
Local: Fri, Sep 19 2008 4:42 am
Subject: Re: Template inheritance and {% include %} tags
On Sep 18, 11:58 pm, SmileyChris <smileych...@gmail.com> wrote:

> I think you missed the point, Simon.

> Michael isn't talking about self-referencing extending, he's talking
> about blocks in statically included templates ({% include "bit.htm"
> %}).

Ah yes, sorry - misunderstood the original e-mail.

Cheers,

Simon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »