from django.http import HttpResponseRedirect def my_view(request): redirect_url = '/home/' return HttpResponseRedirect(redirect_url)
from django.http import HttpResponseRedirect def logout(request): response = HttpResponseRedirect('/login/') response.delete_cookie('my_cookie') return responseIn this example, we first create a HttpResponseRedirect object and assign it to the variable 'response'. Then, we use the 'delete_cookie' method to delete the 'my_cookie' cookie from the response object. Finally, the response object is returned to redirect the request to the login page.