]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/middleware/cancel.py
Access request trough singleton where necessarry
[osqa.git] / forum / middleware / cancel.py
index 15a4371dabf83c10b01ebbeda4be3c273b303e0a..9d8f8702e66ad1b25507b72b90449a23d99642eb 100644 (file)
@@ -1,6 +1,8 @@
 from django.http import HttpResponseRedirect
 from django.http import HttpResponseRedirect
-from forum.utils.forms import get_next_url
+from forum.forms import get_next_url
 import logging
 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:
 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'
                 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
             return HttpResponseRedirect(get_next_url(request))
         else:
             return None