Complete the code to import the redirect function from Django shortcuts.
from django.shortcuts import [1]
The redirect function is imported from django.shortcuts to perform HTTP redirects.
Complete the code to redirect the user to the URL named 'home'.
return [1]('home')
The redirect function is used to send the user to the URL named 'home'.
Fix the error in the redirect call to use the correct function.
return [1]('/dashboard/')
The correct function to redirect to a URL is redirect. Using HttpResponse or render will not redirect.
Fill both blanks to redirect to a URL named 'profile' with an argument user_id.
from django.urls import [1] return redirect([2]('profile', args=[user_id]))
The reverse function builds the URL from the name and arguments. Then redirect sends the user there.
Fill all three blanks to redirect to a named URL 'article-detail' with keyword argument 'pk' equal to article.id.
from django.urls import [1] url = [2]('article-detail', [3]={'pk': article.id}) return redirect(url)
reverse builds the URL. The keyword arguments are passed using kwargs as a dictionary.