Verified Commit e241fb3c authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Allow the album cover to return None when the album has no images

parent 735514e6
......@@ -167,9 +167,10 @@ class Album(models.Model, metaclass=ModelTranslateMeta):
def cover(self):
cover = None
if self._cover is not None:
return self._cover
elif self.photo_set.exists():
cover = random.choice(self.photo_set.all())
return cover
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment