Derek Stegelman

Django Infuse: Save and Continue Wizard

This month I released an update to django-infuse to include alpha support for save and continue form wizards. I have used Django's built in Form Wizard for quite some time in different applications and it works really well. One thing it does not include out of the box is support for saving each form incrementally. When you have longer form processes, such as a scholarship form, it is often helpful to allow users to save their progress and continue later. I created the Save and Continue mixin for just this process. I have this in alpha status because I had to extract and commonize a lot of the custom development I had to done to allow this to be used easily by other developers.

Please check out django-infuse and leave me some feedback on how I could improve on it.

I've included a snippet from the readme to introduce the save and continue mixin.

This mixin is still very much in a alpha status. The django form wizard does not support the concept of 'Finish Later' or any built in ability to save the form 'half done'. This mixin provides a way for developers to add a 'Finish Later' functionality to their form wizard.

In order to use the 'Finish Later' functionality you must add a button/input element on your form wizard templates and name it 'save_only'

Next inherit the SaveAndContinue Mixin ``` from infuse.wizard.mixins import SaveAndContinueWizard

class MyFinishLaterWizard(SaveAndContinueWizard):

This url is where the user will be redirected to when

they click the 'Finish Later' button

saveonlyurl = reverselazy('wheretogowhenuserssaves') ` In addition to thesaveonlyurlthat you are required to set, you may also provide the following methods: ` def postsave_only(self): pass

def processwizardgotostep(self, wizardgotostep): if wizardgotostep and wizardgotostep in self.getformlist(): self.storage.currentstep = wizardgotostep form = self.getform( data=self.storage.getstepdata(self.steps.current), files=self.storage.getstep_files(self.steps.current)) return self.render(form)

def pre_process(self, form):
pass

def additional_file_processing(self):
pass
```

``post_save_only`` - Called when save_only is executed. Provides a way to hook into the save_only processor
``pre_process`` - Do any pre processing before forms are attempted to save. Can be used to setup formsets.
``additional_file_processing`` - Do any additional file processing. I use this to make sure that files saved to AWS are saved with the correct file name.
``process_wizard_goto_step`` - Allows you to override the default behaviour of going between steps.
This particular mixin is extreamly powerful, but is in a constantly changing state. If you are using it, please provide some feedback of how and what your using it for, as well as any improvements you have.

Django Infuse on Github