Complete the code to import the generic CreateView class from Django.
from django.views.generic import [1]
The CreateView class is imported from django.views.generic to create new objects easily.
Complete the code to specify the model for the CreateView.
class BookCreateView(CreateView): model = [1]
The model attribute tells the CreateView which database model to create an object for. Here, it is Book.
Fix the error in the form_class assignment to use the correct form class.
class BookCreateView(CreateView): form_class = [1]
The form_class should be the form related to the model you want to create, here BookForm.
Fill both blanks to set the template name and success URL for the CreateView.
class BookCreateView(CreateView): template_name = '[1]' success_url = '[2]'
The template_name should point to the HTML file used to render the form, and success_url is where the user is redirected after successful creation.
Fill all three blanks to complete the CreateView with model, fields, and success URL.
class AuthorCreateView(CreateView): model = [1] fields = ['first_name', 'last_name'] success_url = '[2]' # URL pattern path('authors/add/', [3].as_view(), name='author-add')
The model is Author, the success_url redirects to the authors list, and the URL pattern uses AuthorCreateView to handle the request.