update trainee management
This commit is contained in:
@@ -95,6 +95,8 @@ class SupervisorFilter(django_filters.FilterSet):
|
|||||||
fields = {
|
fields = {
|
||||||
"name": ["contains"],
|
"name": ["contains"],
|
||||||
"email": ["contains"],
|
"email": ["contains"],
|
||||||
|
"active": ["exact"],
|
||||||
|
"site": ["exact"],
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|||||||
+10
-1
@@ -307,9 +307,18 @@ class ExaminationTable(tables.Table):
|
|||||||
sequence = ("examination",)
|
sequence = ("examination",)
|
||||||
|
|
||||||
class SupervisorTable(tables.Table):
|
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:
|
class Meta:
|
||||||
model = Supervisor
|
model = Supervisor
|
||||||
template_name = "django_tables2/bootstrap4.html"
|
template_name = "django_tables2/bootstrap4.html"
|
||||||
|
|
||||||
sequence = ("name", "email")
|
sequence = ("name", "email")
|
||||||
|
exclude = ("id",)
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
{% render_table table %}
|
{% render_table table %}
|
||||||
|
|
||||||
<ul id="supervisor-list">
|
{% comment %} <ul id="supervisor-list">
|
||||||
{% for supervisor in object_list %}
|
{% for supervisor in object_list %}
|
||||||
<li class="supervisor"><a href="{% url 'generic:supervisor_detail' pk=supervisor.pk %}">{{supervisor.name}}</a>
|
<li class="supervisor"><a href="{% url 'generic:supervisor_detail' pk=supervisor.pk %}">{{supervisor.name}}</a>
|
||||||
<br/>{{supervisor.email}} [{{supervisor.site}}]
|
<br/>{{supervisor.email}} [{{supervisor.site}}]
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul> {% endcomment %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -16,42 +16,62 @@
|
|||||||
{{grade}}
|
{{grade}}
|
||||||
{% endif %}Trainees
|
{% endif %}Trainees
|
||||||
</h2>
|
</h2>
|
||||||
<table>
|
<form>
|
||||||
<tr class="header"><th>Name</th><th>Grade</th><th>Email</th><th>Supervisor</th><th>Edit</th></tr>
|
<table>
|
||||||
|
<tr class="header">
|
||||||
{% for trainee in trainees %}
|
<th>Name</th>
|
||||||
<tr class="trainee">
|
<th>Grade</th><th>Email</th><th>Supervisor</th><th>Edit</th>
|
||||||
<td>{{trainee.user.first_name}} {{trainee.user.last_name}}</td>
|
<th class="trainee-bulk-edit">Bulk Edit<br/>
|
||||||
<td
|
<span _="on click log 'test' then log 'hello' then repeat for i in <input/>
|
||||||
{% if not trainee.grade %}
|
set i.checked to not i.checked
|
||||||
class="no-grade"
|
">Toggle All</span>
|
||||||
{% endif %}
|
</th>
|
||||||
>{{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>
|
|
||||||
|
|
||||||
</tr>
|
</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>
|
<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>
|
<style>
|
||||||
.add-supervisor, .add-grade {
|
.add-supervisor, .add-grade {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
@@ -61,6 +81,14 @@
|
|||||||
opacity: 50%;
|
opacity: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.remove-trainee, .trainee-bulk-edit {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.show {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user