Skip to content

Instantly share code, notes, and snippets.

@jsanchezpando
jsanchezpando / middleware.py
Created Dec 20, 2012
Simple Django super class to track user and save creator and modifier of a Model.
View middleware.py
from myapp.utils import set_current_user
class CurrentUserMiddleware:
def process_request(self, request):
set_current_user(getattr(request, 'user', None))