from apps flash models import Message class Middleware def process_res

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from apps.flash.models import Message
class Middleware:
def process_response(self, request, response):
try:
if len(request.message):
request.session['message'] = request.message
except:
pass
return response
def process_request(self, request):
request.message = Message()