Permalink
Browse files

Fixed #3204 -- Changed FormPreview to use RequestContext

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4259 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent b9eb649 commit 3dbaf60b865e98b84f0cbd8c104715774cdc1cf5 @adrianholovaty adrianholovaty committed Dec 29, 2006
Showing with 8 additions and 4 deletions.
  1. +8 −4 django/contrib/formtools/preview.py
View
12 django/contrib/formtools/preview.py
@@ -91,7 +91,9 @@ def unused_name(self, name):
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 @@ def preview_post(self, request):
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 @@ def post_post(self, request):
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 ########################

0 comments on commit 3dbaf60

Please sign in to comment.