start cleaning up trainee management
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
{% for i in "123456"|make_list %}
|
||||
<a href='{% url "trainees_grade" "ST"|add:i %}'>ST{{i}}</a>{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
<a href="{% url 'account_create' %}">Add trainee</a>
|
||||
|
||||
<h2>
|
||||
{% if grade %}
|
||||
@@ -38,7 +39,12 @@
|
||||
<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></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>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
@@ -113,6 +113,11 @@ urlpatterns = [
|
||||
views.users_bulk_edit,
|
||||
name="users_bulk_edit",
|
||||
),
|
||||
path(
|
||||
"user/<int:user_id>/not_trainee",
|
||||
views.user_not_trainee,
|
||||
name="user_not_trainee",
|
||||
),
|
||||
path("user/group/", views.user_group_view, name="user_group_view"),
|
||||
path("user/group/all", views.user_group_view_all, name="user_group_view_all"),
|
||||
path(
|
||||
|
||||
@@ -2791,6 +2791,14 @@ def get_user_selection_from_request(request):
|
||||
user_models = User.objects.filter(id__in=selected_users)
|
||||
return user_models
|
||||
|
||||
@user_is_cid_user_manager
|
||||
def user_not_trainee(request, user_id):
|
||||
user = get_object_or_404(User, pk=user_id)
|
||||
|
||||
user.userprofile.peninsula_trainee = False
|
||||
user.userprofile.save()
|
||||
|
||||
return HttpResponse(f"{user.username} is no longer a trainee", content_type="text/plain")
|
||||
|
||||
@user_is_cid_user_manager
|
||||
def users_bulk_edit(request):
|
||||
|
||||
@@ -1275,3 +1275,11 @@ tr:has(> td > a) {
|
||||
color: lightgray;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.hover-highlight {
|
||||
opacity: 50%;
|
||||
}
|
||||
.hover-highlight:hover {
|
||||
opacity: 100%;
|
||||
color:purple;
|
||||
}
|
||||
Reference in New Issue
Block a user