jazzband / django-formtools

A set of high-level abstractions for Django forms
https://django-formtools.readthedocs.io
BSD 3-Clause "New" or "Revised" License
804 stars 135 forks source link

FormWizard needs confirmation step logic #17

Open gchp opened 9 years ago

gchp commented 9 years ago

This issue was originally submitted on Trac (#21644). I've added some snippets from the original ticket below, see the link above for the full conversation.


The FormWizard needs to handle a confirmation step that is capable of easily outputting a readonly copy of all step data. It is currently very difficult to support a confirmation step in the FormWizard workflow. The confirmation step needs access to the "final_form_list" created in the render_done() method and passed to the done() method. This is important so the user can see the data he is confirming.

I.e. the confirmation step as presented in the documentation ​https://docs.djangoproject.com/en/1.6/ref/contrib/formtools/form-wizard/#using-a-different-template-for-each-form does not satisfy the requirements for confirmation since the user cannot actually see his order that he is supposed to confirm.

This could be worked into the render_done() method, or broken into two steps. However, currently, one must duplicate a ton of code to render a confirmation view that outputs a readonly copy of the previous steps.

This could be implemented in a way that allows the developer to "opt out" of the confirmation if the specific FormWizard in question does not need a confirmation step.

EDIT: this cannot currently be performed easily in the done() method override because render_done() calls self.storage.reset() after it calls the done() method.

luzfcb commented 9 years ago

@thenewguy django-formtools has moved to outside of django contribs, in this separate repository. this issue is still relevant to you?

thenewguy commented 9 years ago

@luzfcb This is relevant to me but work has currently taken me in a different direction and I haven't been able to swing back around to this yet unfortunately.

dbinetti commented 8 years ago

This issue is relevant to me. Was trying to get this accomplished in the done() method until I saw this.

Validating the wizard as a whole strikes me as a fairly common use-case. I am not qualified to write a patch but am happy to help with documentation or any other place if this issue is taken back up.

thanks @luzfcb @thenewguy @gchp @jezdez for your work on this...

schinckel commented 8 years ago

My solution was to have a ConfirmationForm, which is used as a step. This then requires pulling in all of the previous steps cleaned data for rendering.