Also ensure unmanaged transaction is committed after purge
authorMagnus Hagander <magnus@hagander.net>
Sat, 19 Oct 2013 13:47:32 +0000 (15:47 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sat, 19 Oct 2013 13:47:32 +0000 (15:47 +0200)
pgweb/survey/views.py

index 68e84b5a78e42a50126bff5fe3dc51d3b5041b41..5a28ee949b69f6bb88ac940d5c27f36373cd4d72 100644 (file)
@@ -1,6 +1,6 @@
 from django.shortcuts import render_to_response, get_object_or_404
 from django.http import HttpResponse, Http404, HttpResponseRedirect
-from django.db import connection
+from django.db import connection, transaction
 from django.template.defaultfilters import slugify
 from django.views.decorators.csrf import csrf_exempt
 
@@ -58,6 +58,7 @@ def vote(request, surveyid):
        # do it properly. Possibly because of the cute stuff we do with
        # getattr/setattr above.
        varnish_purge("/community/survey/%s/" % surveyid)
+       transaction.commit_unless_managed()
 
        return HttpResponseRedirect("/community/survey/%s/" % surveyid)