mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Merge pull request #6 from vfigueiro/master
quick fix for AttributeError at admin urls
This commit is contained in:
commit
6c3ec169ee
1 changed files with 4 additions and 2 deletions
|
|
@ -32,7 +32,8 @@ class AuditlogMiddleware(object):
|
|||
Disconnects the signal receiver to prevent it from staying active.
|
||||
"""
|
||||
# Disconnecting the signal receiver is required because it will not be garbage collected (non-weak reference)
|
||||
pre_save.disconnect(sender=LogEntry, dispatch_uid=(self.__class__, request.auditlog_ts))
|
||||
if hasattr(request, 'auditlog_ts'): # admin wipes auditlog_ts from request...
|
||||
pre_save.disconnect(sender=LogEntry, dispatch_uid=(self.__class__, request.auditlog_ts))
|
||||
|
||||
return response
|
||||
|
||||
|
|
@ -40,7 +41,8 @@ class AuditlogMiddleware(object):
|
|||
"""
|
||||
Disconnects the signal receiver to prevent it from staying active in case of an exception.
|
||||
"""
|
||||
pre_save.disconnect(sender=LogEntry, dispatch_uid=(self.__class__, request.auditlog_ts))
|
||||
if hasattr(request, 'auditlog_ts'):
|
||||
pre_save.disconnect(sender=LogEntry, dispatch_uid=(self.__class__, request.auditlog_ts))
|
||||
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue