Complete the code to import the generic UpdateView class from Django.
from django.views.generic import [1]
The UpdateView class is used to create views that edit existing objects in Django.
Complete the code to specify the model to edit in the UpdateView subclass.
class BookUpdateView(UpdateView): model = [1]
The model attribute tells the UpdateView which database model to edit. Here, it should be Book.
Fix the error in the UpdateView by completing the code to specify the fields to edit.
class BookUpdateView(UpdateView): model = Book fields = [1]
The fields attribute must be a list or tuple of strings naming the model fields to edit. So it should be ['title', 'author'].
Fill both blanks to complete the URL pattern for the UpdateView with a primary key parameter.
path('book/<[1]:pk>/edit/', BookUpdateView.as_view(), name='book_edit')
The URL pattern uses int to capture the primary key as an integer.
Fill all three blanks to complete the UpdateView with success URL and template name.
class BookUpdateView(UpdateView): model = Book fields = ['title', 'author'] template_name = [1] success_url = reverse_lazy([2]) # In urls.py path('book/<int:pk>/edit/', [3].as_view(), name='book_edit')
The template_name should point to the form template. The success_url uses the named URL for the book list. The URL pattern uses the BookUpdateView class.