Reviews page

Report a typo

Let's say you have a template in the book/templates/book/reviews.html file. In this task, you need to process the request and give the reviews to the template to display. To do so, pass the reviews list (already defined in the class) to the context argument, by the key "reviews".

By default, Django looks for templates in all of your <application_name>/templates directories, so do not include book/templates in the template path.
Write a program in Python 3
from django.shortcuts import render
from django.views import View


class ReviewView(View):
reviews = ['That book was supercalifragilisticexpialidocious', 'It was a ok, I guess']

def get(self, request, *args, **kwargs):
...
___

Create a free account to access the full topic