Ticket #4362: preview.diff
File preview.diff, 1.2 KB (added by , 17 years ago) |
---|
-
django/contrib/formtools/preview.py
101 101 f = self.form(request.POST, auto_id=AUTO_ID) 102 102 context = {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state} 103 103 if f.is_valid(): 104 self.edit_field = self.unused_name('edit') 105 context['edit_field'] = self.edit_field 104 106 context['hash_field'] = self.unused_name('hash') 105 107 context['hash_value'] = self.security_hash(request, f) 106 108 return render_to_response(self.preview_template, context, context_instance=RequestContext(request)) … … 110 112 def post_post(self, request): 111 113 "Validates the POST data. If valid, calls done(). Else, redisplays form." 112 114 f = self.form(request.POST, auto_id=AUTO_ID) 113 if f.is_valid():115 if not request.has_key(self.edit_field) and f.is_valid(): 114 116 if self.security_hash(request, f) != request.POST.get(self.unused_name('hash')): 115 117 return self.failed_hash(request) # Security hash failed. 116 118 return self.done(request, f.cleaned_data)