diff --git a/app/models.py b/app/models.py index 88117bc..889479d 100644 --- a/app/models.py +++ b/app/models.py @@ -54,6 +54,19 @@ class Tag(db.Model): passive_deletes=True, ) + @property + def display_name(self) -> str: + """Human-readable rendering of this tag. + + After the bare-name refactor, `name` holds the display text directly for + every kind except character+fandom, which gets the '(Fandom)' suffix + appended here. Pre-migration data (with 'kind:' prefix in name) still + renders sanely via the else branch — callers see the raw stored string. + """ + if self.kind == 'character' and self.fandom is not None: + return f"{self.name} ({self.fandom.name})" + return self.name + class ArchiveRecord(db.Model): """ Tracks archives we've processed so we can skip re-importing the same large file.