mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-21 02:58:43 -06:00
Fixes #20859: Object counts widget should handle models without restrict()
This commit is contained in:
@@ -209,7 +209,10 @@ class ObjectCountsWidget(DashboardWidget):
|
|||||||
url = get_action_url(model, action='list')
|
url = get_action_url(model, action='list')
|
||||||
except NoReverseMatch:
|
except NoReverseMatch:
|
||||||
url = None
|
url = None
|
||||||
qs = model.objects.restrict(request.user, 'view')
|
try:
|
||||||
|
qs = model.objects.restrict(request.user, 'view')
|
||||||
|
except AttributeError:
|
||||||
|
qs = model.objects.all()
|
||||||
# Apply any specified filters
|
# Apply any specified filters
|
||||||
if url and (filters := self.config.get('filters')):
|
if url and (filters := self.config.get('filters')):
|
||||||
params = dict_to_querydict(filters)
|
params = dict_to_querydict(filters)
|
||||||
|
|||||||
Reference in New Issue
Block a user