Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 3dbaf60b865e98b84f0cbd8c104715774cdc1cf5 1 parent b9eb649
Adrian Holovaty authored December 29, 2006

Showing 1 changed file with 8 additions and 4 deletions. Show diff stats Hide diff stats

  1. 12  django/contrib/formtools/preview.py
12  django/contrib/formtools/preview.py
@@ -91,7 +91,9 @@ def unused_name(self, name):
91 91
     def preview_get(self, request):
92 92
         "Displays the form"
93 93
         f = self.form(auto_id=AUTO_ID)
94  
-        return render_to_response(self.form_template, {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state})
  94
+        return render_to_response(self.form_template,
  95
+            {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state},
  96
+            context_instance=RequestContext(request))
95 97
 
96 98
     def preview_post(self, request):
97 99
         "Validates the POST data. If valid, displays the preview page. Else, redisplays form."
@@ -100,9 +102,9 @@ def preview_post(self, request):
100 102
         if f.is_valid():
101 103
             context['hash_field'] = self.unused_name('hash')
102 104
             context['hash_value'] = self.security_hash(request, f)
103  
-            return render_to_response(self.preview_template, context)
  105
+            return render_to_response(self.preview_template, context, context_instance=RequestContext(request))
104 106
         else:
105  
-            return render_to_response(self.form_template, context)
  107
+            return render_to_response(self.form_template, context, context_instance=RequestContext(request))
106 108
 
107 109
     def post_post(self, request):
108 110
         "Validates the POST data. If valid, calls done(). Else, redisplays form."
@@ -112,7 +114,9 @@ def post_post(self, request):
112 114
                 return self.failed_hash(request) # Security hash failed.
113 115
             return self.done(request, f.clean_data)
114 116
         else:
115  
-            return render_to_response(self.form_template, {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state})
  117
+            return render_to_response(self.form_template,
  118
+                {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state},
  119
+                context_instance=RequestContext(request))
116 120
 
117 121
     # METHODS SUBCLASSES MIGHT OVERRIDE IF APPROPRIATE ########################
118 122
 

0 notes on commit 3dbaf60

Please sign in to comment.
Something went wrong with that request. Please try again.