summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2010-02-22 05:00:36 +0000
committerJustin Bronn <jbronn@gmail.com>2010-02-22 05:00:36 +0000
commita9b2ac25d1760e1b8e01632544b7f503ccab8577 (patch)
tree8cf939ff2bbfe5a89533c4116a785e1840947940 /django
parent98101787067dd6fd9e7bf2c852bb403615cdd9e3 (diff)
Fixed #9147 -- Added `FormPreview.process_preview` customization hook. Thanks, bthomas and thalin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/formtools/preview.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/django/contrib/formtools/preview.py b/django/contrib/formtools/preview.py
index 856343a0df..f3d86ee037 100644
--- a/django/contrib/formtools/preview.py
+++ b/django/contrib/formtools/preview.py
@@ -60,6 +60,7 @@ class FormPreview(object):
f = self.form(request.POST, auto_id=AUTO_ID)
context = {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state}
if f.is_valid():
+ self.process_preview(request, f, context)
context['hash_field'] = self.unused_name('hash')
context['hash_value'] = self.security_hash(request, f)
return render_to_response(self.preview_template, context, context_instance=RequestContext(request))
@@ -96,6 +97,13 @@ class FormPreview(object):
"""
pass
+ def process_preview(self, request, form, context):
+ """
+ Given a validated form, performs any extra processing before displaying
+ the preview page, and saves any extra data in context.
+ """
+ pass
+
def security_hash(self, request, form):
"""
Calculates the security hash for the given HttpRequest and Form instances.