2

hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page, old data are flushed, and i insert new data, i submit again but some old data remains when i see the final view. the problem remain even if i restart the debug server. it seems that there's some data-caching problem that i can solve only flushing browser cache (and sometimes not). this is the view code: http://dpaste.com/643569/ and the first template code: http://dpaste.com/640960/. someone here on stackoverflow.com said me that is 'cache navigator' that control it, and suggest me to use a custom middleware to disable it, so i followed that advice:

    #middleware.py

    from django.http import HttpResponse

    class NoCacheMiddleware(object):

    def process_response(self, request, response):
        response['Pragma'] = 'no-cache'
        response['Cache-Control'] = 'no-cache must-revalidate proxy-revalidate no-  store'
        return response

i created a file middleware.py in a my_app/util, and then i inserted it in the middleware section of settings.py. i've also added the pragma no cache meta tag in the html head section, but none of these helped. the problem remains.

any suggestions?

Luke
  • 1,794
  • 10
  • 43
  • 70

0 Answers0