Complete the code to return an HTML template using Django's render function.
from django.shortcuts import [1] def home(request): return [1](request, 'home.html')
The render function combines a template with a context dictionary and returns an HttpResponse object with that rendered text.
Complete the code to pass a context dictionary to the template.
from django.shortcuts import render def profile(request): context = {'name': 'Alice'} return render(request, 'profile.html', [1])
The third argument to render is the context dictionary that provides data to the template.
Fix the error in the code to correctly return the template with context.
from django.shortcuts import render def dashboard(request): data = {'user': 'Bob'} return render(request, 'dashboard.html', [1]=data)
In Django's render, the context dictionary can be passed as the third positional argument or as the keyword argument context. Here, using keyword syntax, the code should be render(request, 'dashboard.html', context=data).
Fill both blanks to create a view that renders 'about.html' with a title in context.
from django.shortcuts import [1] def about(request): context = {'title': [2] return render(request, 'about.html', context)
You import render to return templates. The context dictionary needs the title string 'About Us'.
Fill all three blanks to render 'contact.html' with name and email in context.
from django.shortcuts import [1] def contact(request): context = {'name': [2], 'email': [3] return render(request, 'contact.html', context)
Use render to return the template. The context dictionary needs string values for name and email, both in quotes.