mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Force resolution of request User object when logging an object deletion (resolves intermittent test failures)
This commit is contained in:
parent
3e6033e9ff
commit
6f5c35c278
@ -29,7 +29,11 @@ def cache_changed_object(instance, **kwargs):
|
|||||||
|
|
||||||
def _record_object_deleted(request, instance, **kwargs):
|
def _record_object_deleted(request, instance, **kwargs):
|
||||||
|
|
||||||
# Record that the object was deleted.
|
# Force resolution of request.user in case it's still a SimpleLazyObject. This seems to happen
|
||||||
|
# occasionally during tests, but haven't been able to determine why.
|
||||||
|
assert request.user.is_authenticated
|
||||||
|
|
||||||
|
# Record that the object was deleted
|
||||||
if hasattr(instance, 'log_change'):
|
if hasattr(instance, 'log_change'):
|
||||||
instance.log_change(request.user, request.id, OBJECTCHANGE_ACTION_DELETE)
|
instance.log_change(request.user, request.id, OBJECTCHANGE_ACTION_DELETE)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user