Skip to content

Commit

Permalink
append v get param to bypass local cache
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunsephton committed Nov 24, 2010
1 parent e0c63a1 commit 6f5f9ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion likes/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from secretballot import views
from secretballot.models import Vote

def can_vote(request, content_type, object_id, vote):
return content_type.model_class().objects.get(id=object_id).can_vote(request)[0]
Expand All @@ -9,5 +10,6 @@ def like(request, content_type, id, vote):
if request.is_ajax():
return views.vote(request, content_type=content_type, object_id=id, vote=vote, template_name='likes/inclusion_tags/likes.html', can_vote_test=can_vote, extra_context={'can_vote': False, 'vote_status': 'voted', "content_type": url_friendly_content_type})
else:
redirect_url = request.META['HTTP_REFERER']
# Redirect to referer but append unique number(determined from global vote count) to end of URL to bypass local cache.
redirect_url = '%s?v=%s' % (request.META['HTTP_REFERER'], Vote.objects.count() + 1)
return views.vote(request, content_type=content_type, object_id=id, vote=vote, redirect_url=redirect_url, can_vote_test=can_vote)

0 comments on commit 6f5f9ae

Please sign in to comment.