Skip to content

Commit 0459fb0

Browse files
committed
Add user_list page with datatable of users
1 parent a94e672 commit 0459fb0

File tree

1 file changed

+45
-23
lines changed

1 file changed

+45
-23
lines changed

accounts/templates/user_list.html

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,50 @@
11
{% extends 'base.html' %}
22
{% block title %}User List{% endblock %}
3-
{% block page_heading %}
4-
<h2>User List</h2>
5-
<hr>
3+
{% block page_heading %}<i class="material-icons">people</i> User List{% endblock %}
4+
{% block head %}
5+
<!-- <link rel="stylesheet" href="//cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"> -->
6+
<link rel="stylesheet" type="text/css"
7+
href="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-html5-1.6.1/cr-1.5.2/r-2.2.3/sp-1.0.1/sl-1.3.1/datatables.min.css" />
68
{% endblock %}
79
{% block content %}
8-
<table class="table table-sm">
9-
<thead>
10-
<tr>
11-
<th scope="col">ID</th>
12-
<th scope="col">User</th>
13-
<th scope="col">Role</th>
14-
<th scope="col">Email</th>
15-
</tr>
16-
</thead>
17-
<tbody>
18-
{% for user in users %}
19-
<tr>
20-
<td scope="row">{{ user.id }}</td>
21-
<td>{{ user.username }}</td>
22-
<td>placeholder</td>
23-
<td>{{ user.email }}</td>
24-
</tr>
25-
{% endfor %}
26-
</tbody>
27-
</table>
10+
<div class="row">
11+
<div class="col col-12">
12+
<table id="user-table" class="table display">
13+
<thead>
14+
<tr>
15+
<th>ID</th>
16+
<th>User</th>
17+
<th>First Name</th>
18+
<th>Last Name</th>
19+
<th>Role</th>
20+
<th>SuperUser</th>
21+
<th>Email</th>
22+
</tr>
23+
</thead>
24+
<tbody>
25+
{% for user in users %}
26+
<tr>
27+
<td>{{ user.id }}</td>
28+
<td>{{ user.username }}</td>
29+
<td>{{ user.first_name }}</td>
30+
<td>{{ user.last_name }}</td>
31+
<td>placeholder</td>
32+
<td>{{ user.is_superuser }}</td>
33+
<td>{{ user.email }}</td>
34+
</tr>
35+
{% endfor %}
36+
</tbody>
37+
</table>
38+
</div>
39+
</div>
40+
{% endblock %}
41+
{% block scripts %}
42+
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
43+
<script type="text/javascript"
44+
src="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-html5-1.6.1/cr-1.5.2/r-2.2.3/sp-1.0.1/sl-1.3.1/datatables.min.js"></script>
45+
<script>
46+
$(document).ready(() => {
47+
$('#user-table').DataTable();
48+
});
49+
</script>
2850
{% endblock %}

0 commit comments

Comments
 (0)