(self, *args, **kwargs)
This renders the form or, if needed, does the http redirects.
This renders the form or, if needed, does the http redirects.
This renders the form or if needed does the http redirects .
def get(self, *args, **kwargs):
        """
        This renders the form or, if needed, does the http redirects.
        """
        step_url = kwargs.get('step', None)
        if step_url is None:
            if 'reset' in self.request.GET:
                self.storage.reset()
                self.storage.current_step = self.steps.first
            if self.request.GET:
                query_string = "?%s" % self.request.GET.urlencode()
            else:
                query_string = ""
            return redirect(self.get_step_url(self.steps.current)
                            + query_string)

        # is the current step the "done" name/view?
        elif step_url == self.done_step_name:
            last_step = self.steps.last
            return self.render_done(self.get_form(step=last_step,
                data=self.storage.get_step_data(last_step),
                files=self.storage.get_step_files(last_step)
            ), **kwargs)

        # is the url step name not equal to the step in the storage?
        # if yes, change the step in the storage (if name exists)
        elif step_url == self.steps.current:
            # URL step name and storage step name are equal, render!
            return self.render(self.get_form(
                data=self.storage.current_step_data,
                files=self.storage.current_step_files,
            ), **kwargs)

        elif step_url in self.get_form_list():
            self.storage.current_step = step_url
            return self.render(self.get_form(
                data=self.storage.current_step_data,
                files=self.storage.current_step_files,
            ), **kwargs)

        # invalid step name, reset to first and redirect.
        else:
            self.storage.current_step = self.steps.first
            return redirect(self.get_step_url(self.steps.first))
def get ( self , * args , * * kwargs ) : step_url = kwargs . get ( 'step' , None ) if step_url is None : if 'reset' in self . request . GET : self . storage . reset ( ) self . storage . current_step = self . steps . first if self . request . GET : query_string = "?%s" % self . request . GET . urlencode ( ) else : query_string = "" return redirect ( self . get_step_url ( self . steps . current ) + query_string ) # is the current step the "done" name/view? elif step_url == self . done_step_name : last_step = self . steps . last return self . render_done ( self . get_form ( step = last_step , data = self . storage . get_step_data ( last_step ) , files = self . storage . get_step_files ( last_step ) ) , * * kwargs ) # is the url step name not equal to the step in the storage? # if yes, change the step in the storage (if name exists) elif step_url == self . steps . current : # URL step name and storage step name are equal, render! return self . render ( self . get_form ( data = self . storage . current_step_data , files = self . storage . current_step_files , ) , * * kwargs ) elif step_url in self . get_form_list ( ) : self . storage . current_step = step_url return self . render ( self . get_form ( data = self . storage . current_step_data , files = self . storage . current_step_files , ) , * * kwargs ) # invalid step name, reset to first and redirect. else : self . storage . current_step = self . steps . first return redirect ( self . get_step_url ( self . steps . first ) )