重定向到absolute_uri有麻烦

时间:2019-01-26 20:55:46

标签: django

我正在尝试重定向到完整网址

当前网址是absolute_uri

currenturl = request.GET.get('currenturl') #lets say this resolves to http://www.google.com/
return redirect(currenturl)

由于它试图解析以下网址,这使我进入404错误页面

http://localhost:8000/accounts/profile/calendar/delete/15/'http://www.google.com/'

1 个答案:

答案 0 :(得分:0)

我正在将模板中的绝对uri传递到带有单个引号的currenturl中。我必须删除单引号。