Commit ce1c94dc authored by Deion Menor's avatar Deion Menor

Fix references to Artist,Song,Album in views

parent 6f20f5ce
...@@ -40,14 +40,14 @@ def search(request): ...@@ -40,14 +40,14 @@ def search(request):
type = request.GET.get('searchtype', '') type = request.GET.get('searchtype', '')
term = request.GET.get('search', '') term = request.GET.get('search', '')
artistAlbums = album.objects.filter(artist__name__contains = term) artistAlbums = Album.objects.filter(artist__name__contains = term)
if type == 'song': if type == 'song':
results = song.objects.filter(song_name__contains = term) results =Song.objects.filter(song_name__contains = term)
elif type == 'album': elif type == 'album':
results = album.objects.filter(album_name__contains = term) results = Album.objects.filter(album_name__contains = term)
elif type == 'artist': elif type == 'artist':
results = artist.objects.filter(name__contains = term) results = Artist.objects.filter(name__contains = term)
context = { context = {
'type': type, 'type': type,
...@@ -58,14 +58,14 @@ def search(request): ...@@ -58,14 +58,14 @@ def search(request):
return render(request, 'search.html', context) return render(request, 'search.html', context)
def artist_profile(request, identifier): def artist_profile(request, identifier):
result = artist.objects.filter(id = identifier) result = Artist.objects.filter(id = identifier)
albums = album.objects.filter(artist = identifier) albums = Album.objects.filter(artist = identifier)
return render(request, 'artist.html', {'result': result[0], 'albums': albums}) return render(request, 'artist.html', {'result': result[0], 'albums': albums})
def album_profile(request, identifier): def album_profile(request, identifier):
result = album.objects.filter(id = identifier) result = Album.objects.filter(id = identifier)
artist_name = result[0].artist.name artist_name = result[0].Artist.name
songs = song.objects.filter(album = identifier) songs =Song.objects.filter(album = identifier)
return render(request, 'album.html', {'result':result[0], 'songs': songs, 'artist': artist_name}) return render(request, 'album.html', {'result':result[0], 'songs': songs, 'artist': artist_name})
# def search(request,term): # def search(request,term):
......
Markdown is supported
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