I think that's a limitation described in the {% include %} docs: 
https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#include. See 
the "Note" box where it says:

The include 
<https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#std:templatetag-include>
 
tag should be considered as an implementation of “render this subtemplate 
and include the HTML”, not as “parse this subtemplate and include its 
contents as if it were part of the parent”. This means that there is no 
shared state between included templates – each include is a completely 
independent rendering process.

Blocks are evaluated *before* they are included. This means that a template 
that includes blocks from another will contain blocks that have *already 
been evaluated and rendered* - not blocks that can be overridden by, for 
example, an extending template.
----
It's difficult for me to make a suggestion about how to structure things 
without a more complete understanding of what you're trying to do.

On Wednesday, October 28, 2015 at 11:28:07 AM UTC-4, svewa wrote:
>
> Hi all,
>
> sorry if it might be a stupid question for pro's but it seems I still miss 
> a deeper knowledge of some design aspects. What I try to do is the 
> following:
>
> <ul>
> {% for obj in objects %}
>         <li>
>             {% include 'item.html' with object=obj %}
>         </li>
> {% endfor %}
> </ul>
>
>
> this I need to to in three different apps with slightly varying appearance 
> of item.html.
>
> So my idea was to create a root_item.html in my root template folder and 
> simply do in item.html the following::
>
> {% extends "root_item.html" %}
> {% block anyblock %}
> {% endblock %}
>
>
> I'am so far that I guess I know that this will not work. Could anyone 
> explain to me the prefered way to achieve this? In words, I need a base 
> template which extensions should be rendered as list items...
>
> Sorry I'am shure it is easy but I am stuck  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/af32f8fd-e83b-4767-8f37-eaccc1ec70b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to