In this lesson, you’re going to create your views and have a visit with your good friend, the AttributeError! According to this error message, the module project.views has no attribute called all_projects, so head over to views.py to create this view:
# Create your views here.
def all_projects(request):
return render(request, 'all_projects.html')
Now, you’re getting a new error message, TemplateDoesNotExist, because you haven’t yet created this template, so Django doesn’t know what to render.
reblark on March 10, 2020
In the bit about using the print command as a debugging tool, when I refreshed the page, the results in the terminal window had two lines <QuerySet [<Project: Project object (1)>]>
It seems like Python must have printed the code line: projects = Project.objects.all() just prior to the print statement. Yes?