from django.core.urlresolvers import resolve
class MyCustomMiddleware(object):
# пробовал так
def process_request(self, request):
request.testvar = 'testval'
# пробовал и так
def process_view(self, request, view_func, view_args, view_kwargs):
request.testvar = 'testval'