Complete the code to import the correct class for rendering a simple template page.
from django.views.generic import [1]
The TemplateView class is used to render simple template pages without extra logic.
Complete the code to define a simple TemplateView class that uses 'about.html' as its template.
class AboutPageView([1]): template_name = 'about.html'
To create a simple page, inherit from TemplateView and set template_name.
Fix the error in the URL pattern to correctly use the AboutPageView class.
from django.urls import path from .views import AboutPageView urlpatterns = [ path('about/', [1].as_view(), name='about'), ]
In URL patterns, you must call as_view() as a method with parentheses to get the view function.
Fill both blanks to add extra context data to the template in a TemplateView subclass.
class ContactPageView(TemplateView): template_name = 'contact.html' def get_context_data(self, **kwargs): context = super().[1](**kwargs) context['email'] = [2] return context
Override get_context_data to add data. Use super().get_context_data(**kwargs) to get base context.
Then add your extra data like the email string.
Fill all three blanks to create a URL pattern for a TemplateView that uses a custom name and template.
from django.urls import path from django.views.generic import [1] urlpatterns = [ path('help/', [2].as_view(template_name=[3]), name='help'), ]
You can use TemplateView directly in URL patterns by calling as_view() with template_name set.
Here, the template is 'help_page.html' and the view class is TemplateView.