Skip to content
Snippets Groups Projects
Commit d868a322 authored by fu2662cw's avatar fu2662cw :speech_balloon:
Browse files

Add meaningful string representations to models

parent 59159dbb
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,9 @@ class CriterionRating(models.Model):
criterion = models.ForeignKey("Criterion", on_delete=models.CASCADE)
sport = models.ForeignKey("Sport", on_delete=models.CASCADE)
def __str__(self):
return str(self.sport) + " - " + str(self.criterion) + ": " + str(self.rating)
class Sport(models.Model):
"""
......@@ -55,6 +58,9 @@ class Criterion(models.Model):
name = models.TextField()
def __str__(self):
return self.name
class CallToMove(models.Model):
"""Defines text and image that are used to show a call to move between questions"""
......@@ -62,6 +68,9 @@ class CallToMove(models.Model):
text = models.TextField()
image = models.ImageField(null=True, max_length=200)
def __str__(self):
return self.text
class KnowledgeSnack(models.Model):
"""Defines text and image that are used to show a KnowledgeSnack between questions"""
......@@ -69,6 +78,9 @@ class KnowledgeSnack(models.Model):
text = models.TextField()
image = models.ImageField(null=True, max_length=200)
def __str__(self):
return self.text
class Question(models.Model):
"""Defines a Question that is assigned to exactly one Criterion"""
......@@ -77,3 +89,6 @@ class Question(models.Model):
criterion = models.OneToOneField(
Criterion, on_delete=models.CASCADE, primary_key=True
)
def __str__(self):
return self.text
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment