Django重定向到带有post d的url

2024-10-01 15:41:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我在我的视图.py我需要用post请求和post数据转到一个url。在

我尝试了HttpResponseRedirect,但它不接受post数据作为参数。在

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'

我想发布到这个网址以及重定向到它。知道怎么做吗?在


Tags: 数据namepyform视图urldata参数

热门问题