I' have a page called 'results.html' from which a user can submit a form. The problem is that sometimes I submit the form and the response is taken from the cache, and other times it actually calls the response method in views.py. Here's an example:
User submits 'The Imitation Game': the correct response is returned to the user and my response function in views prints
[19/Nov/2016 00:50:21] "POST /results/ HTTP/1.1" 200 2414
Response function called!!
Search term: The Imitation Game`
to the console. However, if the user searches this again (or any other search term he/she searched in the past) this is the response:
[19/Nov/2016 00:51:05] "GET /get_data?query=The%20Imitation%20Game HTTP/1.1" 200 18858
Clearly the response method was not called at all. This is also very evident on the front end because out-of-date data is returned to the user on subsequent requests.
The kicker here is that I am using a dummy cache:
# Use dummy cache for development and testing
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
},
'deployment': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
and DEBUG = True
. I am also marking the response method as follows:
@never_cache
def results(request):
I cleared my browser cache, so it's not that either. I'm amazed that this is at all possible. Any help would be much appreciated.