Ticket #9147: preview_9070.diff

File preview_9070.diff, 1.1 KB (added by Bob Thomas, 16 years ago)

Add a process_preview method to FormPreview

  • contrib/formtools/preview.py

     
    6060        f = self.form(request.POST, auto_id=AUTO_ID)
    6161        context = {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state}
    6262        if f.is_valid():
     63            self.process_preview(request, f, context)
    6364            context['hash_field'] = self.unused_name('hash')
    6465            context['hash_value'] = self.security_hash(request, f)
    6566            return render_to_response(self.preview_template, context, context_instance=RequestContext(request))
     
    9697        """
    9798        pass
    9899
     100    def process_preview(self, request, form, context):
     101        """
     102        Given a validated form, performs any extra processing before displaying
     103        the preview page, and saves any extra data in context.
     104        """
     105        pass
     106
    99107    def security_hash(self, request, form):
    100108        """
    101109        Calculates the security hash for the given HttpRequest and Form instances.
Back to Top