update trainee management
This commit is contained in:
@@ -95,6 +95,8 @@ class SupervisorFilter(django_filters.FilterSet):
|
||||
fields = {
|
||||
"name": ["contains"],
|
||||
"email": ["contains"],
|
||||
"active": ["exact"],
|
||||
"site": ["exact"],
|
||||
}
|
||||
|
||||
def __init__(
|
||||
|
||||
+10
-1
@@ -307,9 +307,18 @@ class ExaminationTable(tables.Table):
|
||||
sequence = ("examination",)
|
||||
|
||||
class SupervisorTable(tables.Table):
|
||||
name = tables.Column(
|
||||
linkify=("generic:supervisor_detail", {"pk": tables.A("pk")}),
|
||||
verbose_name="Name",
|
||||
)
|
||||
|
||||
edit = tables.LinkColumn(
|
||||
"generic:supervisor_edit", text="Edit", args=[A("pk")], orderable=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Supervisor
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
|
||||
sequence = ("name", "email")
|
||||
sequence = ("name", "email")
|
||||
exclude = ("id",)
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
{% render_table table %}
|
||||
|
||||
<ul id="supervisor-list">
|
||||
{% comment %} <ul id="supervisor-list">
|
||||
{% for supervisor in object_list %}
|
||||
<li class="supervisor"><a href="{% url 'generic:supervisor_detail' pk=supervisor.pk %}">{{supervisor.name}}</a>
|
||||
<br/>{{supervisor.email}} [{{supervisor.site}}]
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</ul> {% endcomment %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -16,42 +16,62 @@
|
||||
{{grade}}
|
||||
{% endif %}Trainees
|
||||
</h2>
|
||||
<table>
|
||||
<tr class="header"><th>Name</th><th>Grade</th><th>Email</th><th>Supervisor</th><th>Edit</th></tr>
|
||||
|
||||
{% for trainee in trainees %}
|
||||
<tr class="trainee">
|
||||
<td>{{trainee.user.first_name}} {{trainee.user.last_name}}</td>
|
||||
<td
|
||||
{% if not trainee.grade %}
|
||||
class="no-grade"
|
||||
{% endif %}
|
||||
>{{trainee.grade}}{% if not trainee.grade %}
|
||||
<a href="{% url 'account_profile_update' trainee.user.username %}" class="add-grade">add</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{trainee.user.email}}</td>
|
||||
<td
|
||||
{% if not trainee.supervisor %}
|
||||
class="no-supervisor"
|
||||
{% endif %}
|
||||
>{{trainee.supervisor}}{% if not trainee.supervisor %}
|
||||
<a href="{% url 'account_profile_update' trainee.user.username %}" class="add-supervisor">add</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><a href="{% url 'account_update' trainee.user.username %}">User</a>/<a href="{% url 'account_profile_update' trainee.user.username %}">Profile</a>
|
||||
<span class="hover-highlight"><i class="bi bi-x-circle" title="Click to remove trainee status"
|
||||
hx-get = "{% url 'generic:user_not_trainee' trainee.user.pk %}"
|
||||
></i></span>
|
||||
</td>
|
||||
|
||||
<form>
|
||||
<table>
|
||||
<tr class="header">
|
||||
<th>Name</th>
|
||||
<th>Grade</th><th>Email</th><th>Supervisor</th><th>Edit</th>
|
||||
<th class="trainee-bulk-edit">Bulk Edit<br/>
|
||||
<span _="on click log 'test' then log 'hello' then repeat for i in <input/>
|
||||
set i.checked to not i.checked
|
||||
">Toggle All</span>
|
||||
</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
{% for trainee in trainees %}
|
||||
<tr class="trainee">
|
||||
<td>{{trainee.user.first_name}} {{trainee.user.last_name}}</td>
|
||||
<td
|
||||
{% if not trainee.grade %}
|
||||
class="no-grade"
|
||||
{% endif %}
|
||||
>{{trainee.grade}}{% if not trainee.grade %}
|
||||
<a href="{% url 'account_profile_update' trainee.user.username %}" class="add-grade">add</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{trainee.user.email}}</td>
|
||||
<td
|
||||
{% if not trainee.supervisor %}
|
||||
class="no-supervisor"
|
||||
{% endif %}
|
||||
>{{trainee.supervisor}}{% if not trainee.supervisor %}
|
||||
<a href="{% url 'account_profile_update' trainee.user.username %}" class="add-supervisor">add</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><a href="{% url 'account_update' trainee.user.username %}">User</a>/<a href="{% url 'account_profile_update' trainee.user.username %}">Profile</a>
|
||||
<span class="hover-highlight remove-trainee"><i class="bi bi-x-circle" title="Click to remove trainee status"
|
||||
hx-get = "{% url 'generic:user_not_trainee' trainee.user.pk %}"
|
||||
></i></span>
|
||||
</td>
|
||||
<td class="trainee-bulk-edit">
|
||||
<input type="checkbox" name="trainee" value="{{trainee.user.pk}}">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<div class="small-gray">Count: {{trainees|length}}</div>
|
||||
|
||||
<button class="btn btn-sm"
|
||||
_="on click toggle .show on .remove-trainee"
|
||||
>Remove trainees</button>
|
||||
<button class="btn btn-sm"
|
||||
_="on click toggle .show on .trainee-bulk-edit"
|
||||
>Bulk edit trainees</button>
|
||||
|
||||
<style>
|
||||
.add-supervisor, .add-grade {
|
||||
font-size: small;
|
||||
@@ -61,6 +81,14 @@
|
||||
opacity: 50%;
|
||||
}
|
||||
|
||||
.remove-trainee, .trainee-bulk-edit {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.show {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user