diff --git a/RIGS/templatetags/filters.py b/RIGS/templatetags/filters.py
index 0d05c42a..fb722a9d 100644
--- a/RIGS/templatetags/filters.py
+++ b/RIGS/templatetags/filters.py
@@ -10,7 +10,6 @@ from django.utils.safestring import SafeData, mark_safe
from django.utils.text import normalize_newlines
from RIGS import models
-from training import models as tmodels
register = template.Library()
diff --git a/training/models.py b/training/models.py
index 403bee2c..7787d665 100644
--- a/training/models.py
+++ b/training/models.py
@@ -14,6 +14,7 @@ class Trainee(Profile):
for level_qualification in self.levels.select_related('level').all():
if level_qualification.confirmed_on is not None and level_qualification.level.level >= TrainingLevel.SUPERVISOR:
return True
+ return False
def get_records_of_depth(self, depth):
return self.qualifications_obtained.filter(depth=depth).select_related('item', 'trainee', 'supervisor')
@@ -75,6 +76,15 @@ class TrainingItemQualification(models.Model):
if level.user_has_requirements(self.trainee):
level_qualification = TrainingLevelQualification.objects.get_or_create(trainee=self.trainee, level=level)
+ @classmethod
+ def get_colour_from_depth(obj, depth):
+ if depth == 0:
+ return "warning"
+ elif depth == 1:
+ return "success"
+ else:
+ return "info"
+
class Meta:
unique_together = ["trainee", "item", "depth"]
diff --git a/training/templates/trainee_detail.html b/training/templates/trainee_detail.html
index 73f7b8ec..2135d9b2 100644
--- a/training/templates/trainee_detail.html
+++ b/training/templates/trainee_detail.html
@@ -3,6 +3,7 @@
{% load user_has_qualification from tags %}
{% load percentage_complete from tags %}
{% load user_level_if_present from tags %}
+{% load colour_from_depth from tags %}
{% block content %}
@@ -12,7 +13,14 @@
Training Levels
-
Technical Assistant is conferred automatically when the item requirements are met. Technician status is also automatic, but notification of status should be made at the next general meeting, at which point 'approval' should be granted on the system. Supervisor status is not automatic and until signed off at a general meeting, does not count.Correct as of 7th July 2021, check the Training Policy.
+
+
+ - Technical Assistant is conferred automatically when the item requirements are met.
+ - Technician status is also automatic, but notification of status should be made at the next general meeting, at which point 'approval' should be granted on the system.
+ - Supervisor status is not automatic and until signed off at a general meeting, does not count.
+
+
Correct as of 7th July 2021, check the Training Policy.
+
{% for level in levels %}
@@ -47,20 +55,20 @@
-
@@ -68,8 +76,8 @@
-
Training Items
-
Key: Training Started Training Complete Passed Out
+
Training Items
View Detailed Record
+
Key: Training Started Training Complete Passed Out
{% for category in categories %}
@@ -77,7 +85,7 @@
{% for q in object.qualifications_obtained.all %}
{% if q.item.category == category %}
-
{{q.item}} ({{q.date}})
+ {{q.item}} ({{q.date}})
{% endif %}
{% endfor %}
diff --git a/training/templates/trainee_item_list.html b/training/templates/trainee_item_list.html
new file mode 100644
index 00000000..4e3163a5
--- /dev/null
+++ b/training/templates/trainee_item_list.html
@@ -0,0 +1,42 @@
+{% extends 'base_training.html' %}
+
+{% load url_replace from filters %}
+{% load paginator from filters %}
+{% load linkornone from filters %}
+{% load button from filters %}
+{% load colour_from_depth from tags %}
+
+{% block content %}
+
+
+
+
+
+
+ | Training Item |
+ Depth |
+ Date |
+ Supervisor |
+ Notes |
+
+
+
+ {% for object in object_list %}
+
+ | {{ object.item }} |
+ {{ object.get_depth_display }} |
+ {{ object.date }} |
+ {{ object.supervisor }} |
+ {{ object.notes }} |
+
+ {% empty %}
+
+ | Nothing found |
+
+ {% endfor %}
+
+
+
+
+
+{% endblock %}
diff --git a/training/templates/trainee_list.html b/training/templates/trainee_list.html
index d1e67fe0..e2a30a4b 100644
--- a/training/templates/trainee_list.html
+++ b/training/templates/trainee_list.html
@@ -15,15 +15,18 @@
| Name |
Supervisor? |
- - |
+ |
{% for object in object_list %}
- | {{ object.name }} |
- No |
- View Training Record |
+ {{ object.name }} {% if request.user.pk == object.pk %}{%endif%} |
+ {{ object.is_supervisor|yesno|title }} |
+
+ View Training Record
+ View Detailed Record
+ |
{% empty %}
diff --git a/training/templatetags/tags.py b/training/templatetags/tags.py
index 1f70f39e..aaf570a4 100644
--- a/training/templatetags/tags.py
+++ b/training/templatetags/tags.py
@@ -23,3 +23,6 @@ def user_level_if_present(user, level):
def percentage_complete(level, user):
return level.percentage_complete(user)
+@register.simple_tag
+def colour_from_depth(depth):
+ return models.TrainingItemQualification.get_colour_from_depth(depth)
diff --git a/training/urls.py b/training/urls.py
index df38826c..c6caa8fd 100644
--- a/training/urls.py
+++ b/training/urls.py
@@ -20,4 +20,5 @@ urlpatterns = [
path('level//add_requirement/', views.AddLevelRequirement.as_view(), name='add_requirement'),
path('level/remove_requirement//', views.RemoveRequirement.as_view(), name='remove_requirement'),
path('trainee//level//confirm', views.ConfirmLevel.as_view(), name='confirm_level'),
+ path('trainee//item_record', views.TraineeItemDetail.as_view(), name='trainee_item_detail'),
]
diff --git a/training/views.py b/training/views.py
index bfd349e0..e2e48d8f 100644
--- a/training/views.py
+++ b/training/views.py
@@ -37,6 +37,19 @@ class TraineeDetail(views.ProfileDetail):
return context
+class TraineeItemDetail(generic.ListView):
+ model = models.TrainingItemQualification
+ template_name = 'trainee_item_list.html'
+
+ def get_queryset(self):
+ return models.Trainee.objects.get(pk=self.kwargs['pk']).qualifications_obtained.all()
+
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ context["page_title"] = "Detailed Training Record for {}".format(models.Trainee.objects.get(pk=self.kwargs['pk']))
+ return context
+
+
class TraineeList(generic.ListView):
model = models.Trainee
template_name = 'trainee_list.html'