[PR #17342] [MERGED] Hide exception in ObjectCountsWidget for models without a xxx_list view function #15072

Closed
opened 2025-12-30 00:19:47 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/17342
Author: @candlerb
Created: 9/3/2024
Status: Merged
Merged: 9/3/2024
Merged by: @jeremystretch

Base: developHead: candlerb/17341


📝 Commits (2)

  • 70baeb9 Hide exception in ObjectCountsWidget for models without a xxx_list view function
  • a69fa65 Disable hyperlink for invalid view names

📊 Changes

2 files changed (+6 additions, -3 deletions)

View changed files

📝 netbox/extras/dashboard/widgets.py (+5 -2)
📝 netbox/templates/extras/dashboard/widgets/objectcounts.html (+1 -1)

📄 Description

Fixes #17341

This is a quick workaround specifically to stop ObjectCountsWidget raising an exception for models without a xxx_list view function.

(A better, more generally useful solution would be to catch exceptions raised by any widget, and allow the widget pane to be displayed with an error message. That would avoid Netbox becoming unusable for any widget problem, and would also allow the widget settings to be edited to correct the problem)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/17342 **Author:** [@candlerb](https://github.com/candlerb) **Created:** 9/3/2024 **Status:** ✅ Merged **Merged:** 9/3/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `candlerb/17341` --- ### 📝 Commits (2) - [`70baeb9`](https://github.com/netbox-community/netbox/commit/70baeb9913401aced1939077b4066a7e91be5876) Hide exception in ObjectCountsWidget for models without a `xxx_list` view function - [`a69fa65`](https://github.com/netbox-community/netbox/commit/a69fa65669910b232dffa20dbcac46952d0c63b8) Disable hyperlink for invalid view names ### 📊 Changes **2 files changed** (+6 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/dashboard/widgets.py` (+5 -2) 📝 `netbox/templates/extras/dashboard/widgets/objectcounts.html` (+1 -1) </details> ### 📄 Description ### Fixes #17341 This is a quick workaround specifically to stop ObjectCountsWidget raising an exception for models without a `xxx_list` view function. (A better, more generally useful solution would be to catch exceptions raised by *any* widget, and allow the widget pane to be displayed with an error message. That would avoid Netbox becoming unusable for any widget problem, and would also allow the widget settings to be edited to correct the problem) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:19:47 +01:00
adam closed this issue 2025-12-30 00:19:47 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15072