Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django&;X-editable不起作用_Django_Templates_X Editable - Fatal编程技术网

Django&;X-editable不起作用

Django&;X-editable不起作用,django,templates,x-editable,Django,Templates,X Editable,我正在尝试在django模板中应用X-editable with bootstrap 我从这个链接开始学习基本教程 我已经创建了包含javascript的main.js文件。 我在模板中放置了正确的代码,但当我单击用户名并尝试编辑它时,什么也没发生 你知道为什么吗? 我的部分模板代码::: </table> <div class="container"> <h1>X-editable starter template</h

我正在尝试在django模板中应用X-editable with bootstrap

我从这个链接开始学习基本教程

我已经创建了包含javascript的main.js文件。 我在模板中放置了正确的代码,但当我单击用户名并尝试编辑它时,什么也没发生

你知道为什么吗? 我的部分模板代码:::

    </table>

    <div class="container">

      <h1>X-editable starter template</h1>

      <div>
        <span>Username:</span>
        <a href="#" id="username" data-type="text" data-placement="right" data-title="Enter username">superuser</a>
      </div>

      <div>
        <span>Status:</span>
        <a href="#" id="status">Status Test</a>
      </div>


    </div>


        <!-- bootstrap -->
        <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
        <script src="{% static 'js/jquery-2.0.3.min.js' %}"></script>
        <script src="{% static 'js/bootstrap.min.js' %}"></script>

        <!-- x-editable (bootstrap version) -->
        <link href="{% static 'css/bootstrap-editable.css' %}" rel="stylesheet"/>
        <script src="{% static 'js/bootstrap-editable.min.js' %}"></script>

        <!-- main.js -->
        <script src="{% static 'js/main.js' %}"></script>
        <script src="{% static 'js/collapse.js' %}"></script>

{% endblock %}

有控制台错误吗?当我单击“超级用户”时,一点也没有…当我单击它时,浏览器中的链接将从此链接更改为任何可能有一个用于此的plunker?我仅根据您的代码创建了此链接,它按预期工作。以及,另一方面,我强烈建议您将css移到
标记内,而不是使用
标记内。有任何控制台错误吗?当我单击“超级用户”时,一点也没有……当我单击它时,浏览器中的链接将从此链接更改为有任何可能对此进行插入的链接吗?我仅从您的代码创建了此链接,并且它可以作为预期。另外,我强烈建议您将css移到
标记内,而不是使用
标记内。
$(document).ready(function() {
    //toggle `popup` / `inline` mode
    $.fn.editable.defaults.mode = 'popup';

      $('#username').editable({
        type: 'text',
        title: 'Enter username',
        success: function(response, newValue) {
            userModel.set('username', newValue); //update backbone model
        }
    });

    //make status editable
    $('#status').editable({
        type: 'select',
        title: 'Select status',
        placement: 'right',
        value: 2,
        source: [
            {value: 1, text: 'status 1'},
            {value: 2, text: 'status 2'},
            {value: 3, text: 'status 3'}
        ]
        /*
        //uncomment these lines to send data on server
        ,pk: 1
        ,url: '/post'
        */
    });
});