Fix user not showing in list of songs.

This commit is contained in:
Jim Driessen
2017-01-22 18:12:22 +01:00
parent 898588bc64
commit 1b3c335511
3 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import socket, struct, binascii
from django.conf import settings
def song_to_dict(song, hash=False):
def song_to_dict(song, hash=False, user=False):
data = {
'id': song.id,
'artist': song.artist,
@ -13,8 +13,8 @@ def song_to_dict(song, hash=False):
if hash:
data['hash'] = song.hash
if hasattr(song, 'uploader_name') and song.uploader_name is not None and len(song.uploader_name) > 1:
data['uploader_name'] = song.uploader_name
if user and song.user is not None and len(song.user.name) > 1:
data['uploader_name'] = song.user.name
return data