0
我在我的views.py中,我需要去發送帶有發佈請求的url以及發佈數據。Django重定向到具有發佈數據的網址
我試過HttpResponseRedirect,但它不會將數據作爲參數。
class WebPaymentView(FormView):
template_name = "payment/payment.html"
form_class = NameForm
def form_valid(self, form):
# code
return HttpResponseRedirect(url, data=data, content_type="application/x-www-form-urlencoded")
最後行給出了錯誤:
TypeError: __init __() got an unexpected keyword argument 'data'
我要張貼到這個網址以及重定向到它。任何想法如何?
此任何替代方法?我現在使用ajax調用,但我需要調用django rest框架api url需要用戶身份驗證令牌。 P.S新手在Jquery/Ajax – Kishan