def redirect(self, request):
url = request.path<EOL>querystring = request.GET.copy()<EOL>if self.logout_key and self.logout_key in request.GET:<EOL><INDENT>del querystring[self.logout_key]<EOL><DEDENT>if querystring:<EOL><INDENT>url = '<STR_LIT>' % (url, querystring.urlencode())<EOL><DEDENT>return HttpResponseRedirect(url)<EOL>
Handle redirects properly.