]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/middleware/cancel.py
Migrate to Django 1.6
[osqa.git] / forum / middleware / cancel.py
index 2d78a171c5e811ae4c9845a6a06a27ec1e72ec25..9d8f8702e66ad1b25507b72b90449a23d99642eb 100644 (file)
@@ -1,6 +1,8 @@
 from django.http import HttpResponseRedirect
 from forum.forms import get_next_url
 import logging
+from django.contrib import messages
+
 class CancelActionMiddleware(object):
     def process_view(self, request, view_func, view_args, view_kwargs):
         if 'cancel' in request.REQUEST:
@@ -9,7 +11,7 @@ class CancelActionMiddleware(object):
                 msg = getattr(view_func,'CANCEL_MESSAGE')
             except AttributeError:
                 msg = 'action canceled'
-            request.user.message_set.create(message=msg)
+            messages.info(request, msg)
             return HttpResponseRedirect(get_next_url(request))
         else:
             return None