diff --git a/etiquette/objects.py b/etiquette/objects.py index 7cf6bb1..73f2d91 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -260,6 +260,13 @@ class Album(ObjectBase, GroupableMixin): self.photodb.log.debug('Committing - delete album') self.photodb.commit() + @property + def display_name(self): + if self.title: + return self.title + else: + return self.id + def edit(self, title=None, description=None, *, commit=True): ''' Change the title or description. Leave None to keep current value. diff --git a/etiquette_site.py b/etiquette_site.py index d4361c9..852e52a 100644 --- a/etiquette_site.py +++ b/etiquette_site.py @@ -350,6 +350,7 @@ def get_album_zip(albumid): def get_albums_core(): albums = P.get_albums() albums = [a for a in albums if a.parent() is None] + albums.sort(key=lambda x: x.display_name.lower()) return albums @site.route('/albums') diff --git a/templates/album.html b/templates/album.html index 3a5704c..d9163ba 100644 --- a/templates/album.html +++ b/templates/album.html @@ -3,7 +3,7 @@
{% import "photo_card.html" as photo_card %} {% import "header.html" as header %} -{{album.description}}
{% set parent=album.parent() %} {% if parent %} -