def chooseRedirect(request, playground_id, sandbox_id):
"""
Determine whether we redirect to the playground detail or sandbox detail
"""
next = request.META.get('HTTP_REFERER', None) or None
redirectToPlayground = True
if next is not None:
match = resolve(urlparse(next)[2])
if match is not None:
if match.view_name.startswith("sandbox"):
redirectToPlayground = False
if redirectToPlayground:
return HttpResponseRedirect(reverse("playground", args=[playground_id]))
else:
return HttpResponseRedirect(reverse("sandbox-details", args=[playground_id, sandbox_id]))
评论列表
文章目录