Django模板标签到Backbone.js模板标签:包含一个单独的HTML文件

时间:2015-06-17 14:58:23

标签: html django templates backbone.js

我想将此HTML代码中的“include”模板标签从Django基于服务器转换为Backbone.js,以便我可以将我的前端与后端分开,而不是在我的HTML代码中将它们混合在一起;我使用其中三个来添加三个单独的HTML文件中的代码。我还是Backbone.js的新手。

{% load staticfiles %}
<!DOCTYPE html>
<html>
    <head>
        <title>Gregory Desrosiers (uWaterloo) - To Do List</title>

        <!-- Links to static pages in Django development server are not shown for brevity. -->

    </head>
    <body>
        <!-- User Account Bar (includes modals) -->
        {% include "UserAccountBar.html" %}
        <br/><br/><br/><br/><br/>

        <!-- Main Body -->
        <div id="mainBodyBlock">
           {% if request.user.is_authenticated %}
            <!-- The original To Do Task form is not shown for brevity. -->
            <br/><br/>

            {% regroup task_list by category_of_task as tasks_organized_by_category_list %}
            <!-- List of checkboxes based on the categories -->
            <div id="categoryCheckboxes">
                {% include "TaskChecklistCategoryCheckboxes.html" %}
            </div>

            <br/><br/><br/>

            <!-- List of tasks from backend -->
            <div id="listOfThingsToDo">
                {% include "ListOfTasks.html" %}
            </div>
            <br/><br/>
            {% else %}
                <!-- Original code is not shown for brevity. -->
            {% endif %}
        </div>
    </body>
</html>

我知道根据this question有jQuery脚本方法,但是假设我的前端不允许使用除Backbone.js以外的任何其他方法。还有this approach,我的初步印象是它使用起来很麻烦。

Backbone.js是否有可用于包含单独HTML文件的模板标记?

0 个答案:

没有答案