feat: nicer AN name

This commit is contained in:
moanos [he/him] 2024-11-03 16:37:35 +01:00
parent 227fa4d5a8
commit 3c286d84d8

View File

@ -180,7 +180,9 @@ class AdoptionNotice(models.Model):
]
def __str__(self):
return f"{self.name}"
if not hasattr(self, 'adoptionnoticestatus'):
return self.name
return f"[{self.adoptionnoticestatus.as_string()}] {self.name}"
created_at = models.DateField(verbose_name=_('Erstellt am'), default=timezone.now)
last_checked = models.DateTimeField(verbose_name=_('Zuletzt überprüft am'), default=timezone.now)
@ -362,6 +364,9 @@ class AdoptionNoticeStatus(models.Model):
def __str__(self):
return f"{self.adoption_notice}: {self.major_status}, {self.minor_status}"
def as_string(self):
return f"{self.major_status}, {self.minor_status}"
@property
def is_active(self):
return self.major_status == self.ACTIVE