mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Fix error when trying to load detailed item list
This commit is contained in:
@@ -96,14 +96,14 @@ class TrainingItemQualification(models.Model, RevisionMixin):
|
||||
# TODO Maximum depth - some things stop at Complete and you can't be passed out in them
|
||||
|
||||
def __str__(self):
|
||||
return "{} in {} on {}".format(self.get_depth_display(), self.item, self.date.strftime("%b %d %Y"))
|
||||
return f"{self.get_depth_display()} in {self.item} on {self.date.strftime('%b %d %Y')}"
|
||||
|
||||
@property
|
||||
def activity_feed_string(self):
|
||||
return str("{} in {}".format(self.get_depth_display(), self.item))
|
||||
return f"{self.get_depth_display()} in {self.item}"
|
||||
|
||||
@classmethod
|
||||
def get_colour_from_depth(cls, obj, depth):
|
||||
def get_colour_from_depth(cls, depth):
|
||||
if depth == 0:
|
||||
return "warning"
|
||||
if depth == 1:
|
||||
@@ -238,7 +238,8 @@ class TrainingLevelRequirement(models.Model, RevisionMixin):
|
||||
reversion_hide = True
|
||||
|
||||
def __str__(self):
|
||||
return "{} in {}".format(TrainingItemQualification.CHOICES[self.depth][1], self.item)
|
||||
depth = TrainingItemQualification.CHOICES[self.depth][1]
|
||||
return f"{depth} in {self.item}"
|
||||
|
||||
class Meta:
|
||||
unique_together = ["level", "item"]
|
||||
|
||||
@@ -36,3 +36,10 @@ def test_trainee_detail(admin_client, trainee, admin_user):
|
||||
assertNotContains(response, "Your")
|
||||
name = trainee.first_name + " " + trainee.last_name
|
||||
assertContains(response, f"{name}'s Training Record")
|
||||
|
||||
|
||||
def test_trainee_item_detail(admin_client, trainee):
|
||||
url = reverse('trainee_item_detail', kwargs={'pk': trainee.pk})
|
||||
response = admin_client.get(url)
|
||||
assert response.status_code == 200
|
||||
assertContains(response, "Nothing found")
|
||||
|
||||
Reference in New Issue
Block a user