diff --git a/training/forms.py b/training/forms.py index b45a1b8c..961c877b 100644 --- a/training/forms.py +++ b/training/forms.py @@ -6,7 +6,7 @@ from RIGS.models import Profile class SessionLogForm(forms.Form): pass - +# TODO Validation that dates cannot be in the future class QualificationForm(forms.ModelForm): class Meta: model = models.TrainingItemQualification @@ -18,3 +18,4 @@ class QualificationForm(forms.ModelForm): super(QualificationForm, self).__init__(*args, **kwargs) self.fields['trainee'].initial = Profile.objects.get(pk=pk) + diff --git a/training/models.py b/training/models.py index 0fd5b201..e09e351c 100644 --- a/training/models.py +++ b/training/models.py @@ -26,7 +26,6 @@ class TrainingItem(models.Model): return "{}.{} {}".format(self.category.reference_number, self.reference_number, self.name) -# TODO Validation that dates cannot be in the future class TrainingItemQualification(models.Model): STARTED = 0 COMPLETE = 1 @@ -44,10 +43,13 @@ class TrainingItemQualification(models.Model): supervisor = models.ForeignKey('Trainee', related_name='qualifications_granted', on_delete=models.RESTRICT) notes = models.TextField(blank=True) + def __str__(self): + return "{} in {} on {}".format(self.depth, self.item, self.date) + # Levels -# FIXME Common Competencies... class TrainingLevel(models.Model, RevisionMixin): + description = models.CharField(max_length=120) CHOICES = ( (0, 'Technical Assistant'), (1, 'Technician'), @@ -55,7 +57,8 @@ class TrainingLevel(models.Model, RevisionMixin): ) department = models.CharField(max_length=50, null=True) # N.B. Technical Assistant does not have a department level = models.IntegerField(choices=CHOICES) - + + # FIXME Common Competencies... have levels able to depend on other ones - but supervisors need to depend on both common and technican? class TrainingLevelQualification(models.Model): trainee = models.ForeignKey('Trainee', related_name='levels', on_delete=models.RESTRICT) diff --git a/training/templates/trainee_detail.html b/training/templates/trainee_detail.html index f4aca630..d742e495 100644 --- a/training/templates/trainee_detail.html +++ b/training/templates/trainee_detail.html @@ -1,19 +1,14 @@ {% extends 'base_rigs.html' %} {% block content %} - +

Training Levels

-

{{ user.name }} is a...

-
-

Sound Supervisor

-

Power Technician

-

Technical Assistant

-
+{% for level in levels %} + +{% endfor %}

Training Items


@@ -24,7 +19,11 @@
{% for depth in depths %}
  • {{depth.1}}
  • -
  • Dummy Item
  • + {% for q in object.qualifications_obtained.all %} + {% if q.depth == depth.0 and q.item.category == category %} +
  • {{q.item}} ({{q.date}})
  • + {% endif %} + {% endfor %} {% endfor %}