From 3dbaf60b865e98b84f0cbd8c104715774cdc1cf5 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 29 Dec 2006 19:42:56 +0000 Subject: [PATCH] Fixed #3204 -- Changed FormPreview to use RequestContext git-svn-id: http://code.djangoproject.com/svn/django/trunk@4259 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/formtools/preview.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/django/contrib/formtools/preview.py b/django/contrib/formtools/preview.py index 9a9371b5f8..32c1d99e0e 100644 --- a/django/contrib/formtools/preview.py +++ b/django/contrib/formtools/preview.py @@ -91,7 +91,9 @@ class FormPreview(object): def preview_get(self, request): "Displays the form" f = self.form(auto_id=AUTO_ID) - return render_to_response(self.form_template, {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state}) + return render_to_response(self.form_template, + {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state}, + context_instance=RequestContext(request)) def preview_post(self, request): "Validates the POST data. If valid, displays the preview page. Else, redisplays form." @@ -100,9 +102,9 @@ class FormPreview(object): if f.is_valid(): context['hash_field'] = self.unused_name('hash') context['hash_value'] = self.security_hash(request, f) - return render_to_response(self.preview_template, context) + return render_to_response(self.preview_template, context, context_instance=RequestContext(request)) else: - return render_to_response(self.form_template, context) + return render_to_response(self.form_template, context, context_instance=RequestContext(request)) def post_post(self, request): "Validates the POST data. If valid, calls done(). Else, redisplays form." @@ -112,7 +114,9 @@ class FormPreview(object): return self.failed_hash(request) # Security hash failed. return self.done(request, f.clean_data) else: - return render_to_response(self.form_template, {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state}) + return render_to_response(self.form_template, + {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state}, + context_instance=RequestContext(request)) # METHODS SUBCLASSES MIGHT OVERRIDE IF APPROPRIATE ########################