mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-18 04:56:29 -06:00
Tweak ObjectChangeLogView to work with both restricted and unrestricted querysets
This commit is contained in:
parent
2e272132b0
commit
6f8f3f98b4
@ -261,9 +261,11 @@ class ObjectChangeLogView(View):
|
|||||||
|
|
||||||
def get(self, request, model, **kwargs):
|
def get(self, request, model, **kwargs):
|
||||||
|
|
||||||
# Get object my model and kwargs (e.g. slug='foo')
|
# Handle QuerySet restriction of parent object if needed
|
||||||
queryset = model.objects.restrict(request.user, 'view')
|
if hasattr(model.objects, 'restrict'):
|
||||||
obj = get_object_or_404(queryset, **kwargs)
|
obj = get_object_or_404(model.objects.restrict(request.user, 'view'), **kwargs)
|
||||||
|
else:
|
||||||
|
obj = get_object_or_404(model, **kwargs)
|
||||||
|
|
||||||
# Gather all changes for this object (and its related objects)
|
# Gather all changes for this object (and its related objects)
|
||||||
content_type = ContentType.objects.get_for_model(model)
|
content_type = ContentType.objects.get_for_model(model)
|
||||||
|
Loading…
Reference in New Issue
Block a user