Skip to content

Commit

Permalink
Merge pull request #65 from jjkester/1.10-middleware
Browse files Browse the repository at this point in the history
Update middleware for Django 1.10
  • Loading branch information
jjkester authored Aug 17, 2016
2 parents ae056df + 7824fb2 commit f9ae84d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/auditlog/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
from django.apps import apps
from auditlog.models import LogEntry

# Use MiddlewareMixin when present (Django >= 1.10)
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object


threadlocal = threading.local()


class AuditlogMiddleware(object):
class AuditlogMiddleware(MiddlewareMixin):
"""
Middleware to couple the request's user to log items. This is accomplished by currying the signal receiver with the
user from the request (or None if the user is not authenticated).
Expand Down

0 comments on commit f9ae84d

Please sign in to comment.