0

我正在使用 django-formtools 创建一个向导。

我为向导创建了一个视图:

class UserQueryWizard(SessionWizardView):

    template_name = "wizards/index.html"
    form_list = [forms.ShippingForm,
                 forms.ExporterdetailsForm, forms.ImporterdetailsForm, ]

    def done(self, form_list, **kwargs):
        print([form.cleaned_data for form in form_list])
        return render(self.request, 'wizards/index.html', {
            'form_data': [form.cleaned_data for form in form_list],
        })

    def get(self, request, *args, **kwargs):    
        try:
            return self.render(self.get_form())
        except KeyError:
            return super().get(request, *args, **kwargs)

我有另一个可以用 post 请求调用的视图

 path('query/', views.UserQueryView.as_view(), name='user_query'),

我想在我的完成函数中使用 Post 请求调用“查询/”URL

def done(self, form_list, **kwargs):
    print([form.cleaned_data for form in form_list])
    return <--- here with POST data([form.cleaned_data for form in form_list]) 
4

0 回答 0