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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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管理表功能_Django_Django Admin - Fatal编程技术网

模板中的Django管理表功能

模板中的Django管理表功能,django,django-admin,Django,Django Admin,Django在admin中有一个很好的可排序表系统。我想知道如何在我的常规模板中使用它 我找不到关于这个的任何信息。欢迎提供任何线索 提前感谢。 <!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.

Django在admin中有一个很好的可排序表系统。我想知道如何在我的常规模板中使用它

我找不到关于这个的任何信息。欢迎提供任何线索

提前感谢。


<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
   <script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js "> </script>



   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

   <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>






   <script>

   $(document).ready(function() {
    $('#example').DataTable();
      } );

   </script> 


</head>
<body>



<table id="example" class="display"  >
  <thead>
      <tr>
          <th>name</th>
          <th>position</th>
          <th>office</th>
          <th>age</th>
          <th> date </th>

      </tr>
  </thead>
  <tbody>
      {% for i in qs %}
      <tr>
        <td>{{ i.name }}</td>
        <td>{{ i.position }}</td>
        <td>{{ i.office }}</td>
        <td>{{ i.age }}</td>
        <td> {{ i.date }} </td> 
      </tr>
    {% endfor %} 
    </tbody>
  </table>


</body>
</html>
$(文档).ready(函数(){ $(“#示例”).DataTable(); } ); 名称 位置 办公室 年龄 日期 {qs%中的i的%s} {{i.name} {{i.position}} {{i.office} {{i.age}} {{i.date} {%endfor%}

您可以使用带有分页、可排序和搜索功能的无javascript控件。