fnp
/
edumed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
205ab78
)
never cache participant view
author
Jan Szejko
<janek37@gmail.com>
Thu, 19 Jan 2017 15:42:37 +0000
(16:42 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Fri, 20 Jan 2017 09:47:36 +0000
(10:47 +0100)
stage2/views.py
patch
|
blob
|
history
diff --git
a/stage2/views.py
b/stage2/views.py
index
e199de0
..
1116257
100644
(file)
--- a/
stage2/views.py
+++ b/
stage2/views.py
@@
-5,6
+5,8
@@
from django.http import Http404
from django.http.response import HttpResponseRedirect, HttpResponse, HttpResponseForbidden
from django.shortcuts import get_object_or_404, render
from django.utils import timezone
from django.http.response import HttpResponseRedirect, HttpResponse, HttpResponseForbidden
from django.shortcuts import get_object_or_404, render
from django.utils import timezone
+from django.utils.cache import patch_cache_control
+from django.views.decorators.cache import never_cache
from django.views.decorators.http import require_POST
from unidecode import unidecode
from django.views.decorators.http import require_POST
from unidecode import unidecode
@@
-23,13
+25,17
@@
def all_assignments(participant):
return assignments
return assignments
+@never_cache
def participant_view(request, participant_id, key):
participant = get_object_or_404(Participant, id=participant_id)
if not participant.check(key):
raise Http404
def participant_view(request, participant_id, key):
participant = get_object_or_404(Participant, id=participant_id)
if not participant.check(key):
raise Http404
- re
turn
render(request, 'stage2/participant.html', {
+ re
sponse =
render(request, 'stage2/participant.html', {
'participant': participant,
'assignments': all_assignments(participant)})
'participant': participant,
'assignments': all_assignments(participant)})
+ # not needed in Django 1.8
+ patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
+ return response
@require_POST
@require_POST