Django extending from included template

715 Views Asked by At

I want to divide my base.html template into 2 with some differences in style and html. My structure is like this:

base.html

<html>
    <head>
        <p>same content for both templates</p>
    </head>
    {% if category.title == 'something' %}
        {% include "base-copy.html" %}
    {% else %}
    <body>
        <p>content</p>
        .
        .
        .
    </body>
    {% endif %}
</html>

base-copy.html

<body>
    <p>content</p>
    .
    .
    .
</body>

inside the body content there are several blocks and other templates extend from base.html {% extends "base.html" %}. If i just copy the whole block of code from body into the included template the content is not showing but if I leave it on the original base.html the content is showing... Btw I'm using the include statement because otherwise I get the "block" appears more than once error from Django...

any suggestions on how to make this work?

0

There are 0 best solutions below