.
This commit is contained in:
@@ -25,6 +25,7 @@ class Dinosaur(models.Model):
|
||||
weight = models.PositiveSmallIntegerField(default=50)
|
||||
intelligence = models.PositiveSmallIntegerField(default=50)
|
||||
height = models.PositiveSmallIntegerField(default=50)
|
||||
facts = models.TextField(blank=True, help_text='One fact per line; shown as bullet points on the card')
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
@@ -34,6 +35,13 @@ class Dinosaur(models.Model):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@property
|
||||
def facts_list(self):
|
||||
"""Return facts as a list of non-empty lines."""
|
||||
if not self.facts:
|
||||
return []
|
||||
return [f.strip() for f in self.facts.splitlines() if f.strip()]
|
||||
|
||||
|
||||
class BackgroundImage(models.Model):
|
||||
"""Background images used behind card renders.
|
||||
|
||||
Reference in New Issue
Block a user