Wednesday, October 28, 2015

include template which extends something else

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+unsubscribe@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/c8e600f6-8322-40ba-bc3b-8c91aa461087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment