简体   繁体   中英

Including non-form in a Django SessionWizardView

Can a non-form web page be included in a django SessionWizardView?

For example, I want the user to FillOut Form1, Form2, Then View a web page (in same session) (click next), and then Form3? All this while maintaining the same session.

If so, how is this best accomplished? Any examples or snippets?

There's a fairly easy hack for this. Create a plain old form that has one field that is hidden from the user, has no content, and isn't required.

I do this:

class BlankForm(forms.Form):
    nothing     = forms.CharField(required=False, widget=HiddenInput)

Include it in your SessionWizardView call just like the other pages:

SessionWizardView.as_view([Form1, Form2, BlankForm, Form3])

In the template page you can use some logic like this to display info:

{% if wizard.steps.current == '2' %}
    Whatever you want to show on the BlankForm
{% endif %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM