Complete the code to import the function to create HTTP responses in Django.
from django.http import [1]
The HttpResponse class is used to send a response back to the browser in a function-based view.
Complete the function-based view to return a simple HTTP response.
def home_view(request): return [1]("Hello, world!")
The view returns an HttpResponse object with the text to display.
Fix the error in the view function to correctly accept the request parameter.
def about_view([1]): return HttpResponse("About page")
Function-based views must accept the request parameter to handle the incoming HTTP request.
Fill both blanks to import and use the shortcut to render a template in a function-based view.
from django.shortcuts import [1] def contact_view(request): return [2](request, 'contact.html')
The render shortcut combines loading a template and returning an HttpResponse in one step.
Fill all three blanks to create a function-based view that renders a template with context data.
from django.shortcuts import [1] def profile_view(request): context = {'name': [2] return [3](request, 'profile.html', context)
The render function is imported and used to send the template with context. The context dictionary passes data to the template.