mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-18 05:52:15 +00:00
Don't try and create existing level qualifications
This commit is contained in:
@@ -71,9 +71,9 @@ class TrainingItemQualification(models.Model):
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super().save()
|
||||
for level in TrainingLevel.objects.all(): # Mm yes efficiency
|
||||
for level in TrainingLevel.objects.all(): # Mm yes efficiency FIXME
|
||||
if level.user_has_requirements(self.trainee):
|
||||
level_qualification = TrainingLevelQualification.objects.create(trainee=self.trainee, level=level)
|
||||
level_qualification = TrainingLevelQualification.objects.get_or_create(trainee=self.trainee, level=level)
|
||||
|
||||
class Meta:
|
||||
unique_together = ["trainee", "item", "depth"]
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="row">
|
||||
<h2 class="col-12">Training Items</h2><br>
|
||||
<h3 class="col-12">Key: <span class="badge badge-warning">Training Started</span> <span class="badge badge-success">Training Complete</span> <span class="badge badge-info">Passed Out</span></h3>
|
||||
<div class="card-columns">
|
||||
<div class="card-deck">
|
||||
{% for category in categories %}
|
||||
<div class="card mb-3">
|
||||
<h3 class="card-header">{{ category }}</h3>
|
||||
|
||||
@@ -27,7 +27,7 @@ class TraineeDetail(views.ProfileDetail):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(TraineeDetail, self).get_context_data(**kwargs)
|
||||
context["page_title"] = "{}'s Training Record".format(self.object)
|
||||
context["page_title"] = "{}'s Training Record".format(self.object.first_name + " " + self.object.last_name)
|
||||
context["levels"] = models.TrainingLevel.objects.all()
|
||||
context["categories"] = models.TrainingCategory.objects.all().prefetch_related('items')
|
||||
choices = models.TrainingItemQualification.CHOICES
|
||||
|
||||
Reference in New Issue
Block a user