0
Hey, guys, I created a view
to return a HttpResponse
simple importing a class from the models folder as follows:
from .models import Album
and then creating the view function:
def index(request):
all_albums = Album.objects.all()
html = ''
for Album in all_albums:
url = '/music/' + str(album.id) + '/'
html += '<a href="' + url + '">' + album.album_title + '</a><br>'
return HttpResponse(html)
but at various points in my code, specifically where the 'album' class is returning unresolved reference 'album'
and also the Album class that was imported is not being used. However, both the class name and import call are correct as far as I have looked. Any solution or error you have seen?
Thanks! You solved
– Marcus Vinícius