I have a form, after entering the information, based on infomation it filters the database and do some calculation and finally displays the result to a redirected url.
If you make POST request, and after that you're redirecting user, the next request will have empty POST (since now it it another request). So, it is not a surprising behaviour. If you want to save this data between session, you can save it in the user session, for example.
You can modify some of you views (which making redirect, I believe) by adding this code:
Setting a cookie:
def your_view_which_makes_redirect(request):
#.. here is your code
response = HttpResponse( 'blah' )
request_form_data = request.POST #you need to sanitize/clear this data
response.set_cookie('form_data', request_form_data)
Getting cookie:
def your_view_which_renders_page_after_rediret(request):
if request.COOKIES.has_key('form_data'):
value = request.COOKIES['form_data'] #this data also should be sanitized
1) Also you can move name of this cookie to the settings because now they are hardcoded and it is now very good practice. Something like settings.SAVED_FORM_NAME_COOIKE_TOKEN 2) You also have to sanitize data from request.POST and request.COOKIES, because user can place there some malicious data (SQL injection and so on).