Complete the code to import the ListView class from Django.
from django.views.generic import [1]
The ListView class is imported from django.views.generic to create views that display lists of objects.
Complete the code to define a ListView for the model named 'Book'.
class BookListView([1]): model = Book
To display a list of Book objects, the view must inherit from ListView.
Fix the error in the ListView by completing the code to specify the template name.
class AuthorListView(ListView): model = Author template_name = '[1]'
The default template name for a ListView is modelname_list.html. Here, it should be author_list.html.
Fill both blanks to filter the queryset to only active items and order them by name.
class ProductListView(ListView): model = Product queryset = Product.objects.filter([1]).order_by('[2]')
To filter active products, use is_active=True. To order by name ascending, use name.
Fill all three blanks to customize the context object name and paginate the list by 10 items.
class EventListView(ListView): model = Event context_object_name = '[1]' paginate_by = [2] template_name = '[3]'
Use events as the context name for clarity, paginate by 10 items, and use the default template event_list.html.