2016-10-17 159 views
0

好吧,我有我的index.html文件,其中有一個名爲info.html的文件,它從index.html文件中擴展出來,但目前不太適用。這裏是我的代碼:Django擴展模板問題

的index.html

<body> 

    {% include "home/quote.html" %} 

    {% include "home/intro.html" %} 

    {% block content %} 
    {% endblock %} 

    {% include "home/projects.html" %} 

    {% include "home/goals.html" %} 

</body> 

info.html裏

{% extends "home/index.html" %} 

{% block content %} 

<section class="info-section"> 

    <div class="info-section_content"> 

     {% include "home/includes/info-content.html" %} 

    </div> 

</section> 

{% endblock %} 
+0

不行嗎?你怎麼渲染這個? –

回答

1

埃西修復!

在應用程序目錄中的views.py我正在渲染父文件(index.html),所以我現在切換到渲染子文件(info.html),它現在可以工作。

0

,我需要你的項目的一些詳細信息,就知道肯定,但我會檢查,以確保您引用在這裏正確的命名空間:

{% extends "home/index.html" %} 

例如,如果路徑是一樣的東西模板/home/something/info.html或templates/something/home/info.html這可能是問題。