From 718399806a14afc4e17ec73322a9fbef55a1e29e Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 3 Apr 2020 08:49:35 -0700 Subject: [PATCH] Add channel_name to videos before returning them, show on listings. Previously, when viewing a /videos listing, there was a link called (Chan) to bring you to the channel page, but since videos only carried author_id and not author_name it was always kind of ugly. This will inject that attribute on the way out. I know, this would be more properly written as an SQL join in the first place, but my row-dict conversion isn't set up for that and I'm planning on converting this all to object-based returns instead of dicts soon. --- frontends/ycdl_flask/templates/channel.html | 2 +- ycdl/ycdldb.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frontends/ycdl_flask/templates/channel.html b/frontends/ycdl_flask/templates/channel.html index 10dec73..f68c4e6 100644 --- a/frontends/ycdl_flask/templates/channel.html +++ b/frontends/ycdl_flask/templates/channel.html @@ -127,7 +127,7 @@ https://stackoverflow.com/a/35153397 ({{video['duration'] | seconds_to_hms}}) ({{video['views']}}) {% if channel is none %} - (Chan) + ({{video.get('author_name', 'Chan')}}) {% endif %}