diff --git a/boards/models/tag.py b/boards/models/tag.py --- a/boards/models/tag.py +++ b/boards/models/tag.py @@ -89,7 +89,17 @@ class Tag(models.Model, Viewable): blank=True, related_name='children') def get_name(self): - return self.aliases.get(locale=DEFAULT_LOCALE).name + try: + alias = self.aliases.get(locale=DEFAULT_LOCALE) + except TagAlias.DoesNotExist: + alias = self.aliases.first() + + if alias: + return alias.name + else: + # This is an extremely bad situation, somehow we have a tag without + # any alias + return 'BROKEN #{}'.format(self.id) def __str__(self): return self.get_name()