<s> import os <EOL> import tempfile <EOL> from django import forms <EOL> from django . contrib . auth . models import User <EOL> from django . core . files . storage import FileSystemStorage <EOL> from django . forms . formsets import formset_factory <EOL> from django . forms . models import modelformset_factory <EOL> from django . http import HttpResponse <EOL> from django . template import Template , Context <EOL> from formtools . wizard . views import WizardView <EOL> temp_storage_location = tempfile . mkdtemp ( dir = os . environ . get ( '<STR_LIT>' ) ) <EOL> temp_storage = FileSystemStorage ( location = temp_storage_location ) <EOL> class Page1 ( forms . Form ) : <EOL> name = forms . CharField ( max_length = <NUM_LIT:100> ) <EOL> user = forms . ModelChoiceField ( queryset = User . objects . all ( ) ) <EOL> thirsty = forms . NullBooleanField ( ) <EOL> class Page2 ( forms . Form ) : <EOL> address1 = forms . CharField ( max_length = <NUM_LIT:100> ) <EOL> address2 = forms . CharField ( max_length = <NUM_LIT:100> ) <EOL> file1 = forms . FileField ( ) <EOL> class Page3 ( forms . Form ) : <EOL> random_crap = forms . CharField ( max_length = <NUM_LIT:100> ) <EOL> Page4 = formset_factory ( Page3 , extra = <NUM_LIT:2> ) <EOL> class ContactWizard ( WizardView ) : <EOL> file_storage = temp_storage <EOL> def done ( self , form_list , ** kwargs ) : <EOL> c = Context ( { <EOL> '<STR_LIT>' : [ x . cleaned_data for x in form_list ] , <EOL> '<STR_LIT>' : self . get_all_cleaned_data ( ) , <EOL> } ) <EOL> for form in self . form_list . keys ( ) : <EOL> c [ form ] = self . get_cleaned_data_for_step ( form ) <EOL> c [ '<STR_LIT>' ] = self . get_cleaned_data_for_step ( '<STR_LIT>' ) <EOL> return HttpResponse ( Template ( '<STR_LIT>' ) . render ( c ) ) <EOL> def get_context_data ( self , form , ** kwargs ) : <EOL> context = super ( ContactWizard , self ) . get_context_data ( form , ** kwargs ) <EOL> if self . storage . current_step == '<STR_LIT>' : <EOL> context . update ( { '<STR_LIT>' : True } ) <EOL> return context <EOL> class UserForm ( forms . ModelForm ) : <EOL> class Meta : <EOL> model = User <EOL> fields = ( '<STR_LIT:username>' , '<STR_LIT:email>' ) <EOL> UserFormSet = modelformset_factory ( User , form = UserForm ) <EOL> class SessionContactWizard ( ContactWizard ) : <EOL> storage_name = '<STR_LIT>' <EOL> class CookieContactWizard ( ContactWizard ) : <EOL> storage_name = '<STR_LIT>' </s>
