add request.GET variable using django.shortcuts.redirect

前端 未结 4 1994
北荒
北荒 2020-12-04 19:14

Is possible to add GET variables in a redirect ? (Without having to modifiy my urls.py)

If I do redirect(\'url-name\', x)

I get HttpRespo

4条回答
  •  一个人的身影
    2020-12-04 19:43

    Since redirect just returns an HttpResponseRedirect object, you could just alter that:

    response = redirect('url-name', x)
    response['Location'] += '?your=querystring'
    return response
    

提交回复
热议问题