djangoposthttpresponserender-to-response

How to display data resulting from POST in django view?


I have a form that takes a path as input, analyzes files and subfolders in that directory, stores information in a database, then displays some statistics to the user about the files just parsed. This is done currently using a Django view and render_to_response.

According to everything I have read, it's incorrect to use anything other that HttpResponseRedirect when dealing with a POST, as a page generated with POST data would resubmit the form if the page were refreshed.

My issue here is that there's a large amount of summary data ultimately displayed as a result of analyzing files on the provided path. How can I display that data with an httpResponseRedirect? Sending it as GET parameters using django.core.urlresolvers.reverse seems infeasible due to the amount of data.


Solution

  • You could put the data on request.session

    http://www.djangobook.com/en/beta/chapter12/#cn36

    http://docs.djangoproject.com/en/1.2/topics/http/sessions/