The bookmark widget breaks the frontpage when LOGIN_REQUIRED is False #8488

Closed
opened 2025-12-29 20:37:22 +01:00 by adam · 1 comment
Owner

Originally created by @kkthxbye-code on GitHub (Aug 21, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.6.0-beta2

Python version

3.11

Steps to Reproduce

  1. Set LOGIN_REQUIRED = False in configuration.py
  2. Open the frontpage without a logged in session

Expected Behavior

The home view should render

Observed Behavior

The following exception is thrown:

Field 'id' expected a number but got <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f765c2bf150>>.

Issue is here:

5709bc3b2b/netbox/extras/dashboard/widgets.py (L349)

request.user is passed to the filter regardless of the user being logged in or not.

Originally created by @kkthxbye-code on GitHub (Aug 21, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.6.0-beta2 ### Python version 3.11 ### Steps to Reproduce 1. Set `LOGIN_REQUIRED = False` in configuration.py 2. Open the frontpage without a logged in session ### Expected Behavior The home view should render ### Observed Behavior The following exception is thrown: `Field 'id' expected a number but got <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f765c2bf150>>.` Issue is here: https://github.com/netbox-community/netbox/blob/5709bc3b2b60597114555a8ed3f70ee4703a483f/netbox/extras/dashboard/widgets.py#L349 request.user is passed to the filter regardless of the user being logged in or not.
adam added the type: bugstatus: acceptedbetaseverity: medium labels 2025-12-29 20:37:22 +01:00
adam closed this issue 2025-12-29 20:37:22 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Aug 21, 2023):

As a sidenote, I think it would be logical to have a catchall exception handler when rendering a widget, which would log the exception and show an error in the widget box instead of breaking the home view.

@kkthxbye-code commented on GitHub (Aug 21, 2023): As a sidenote, I think it would be logical to have a catchall exception handler when rendering a widget, which would log the exception and show an error in the widget box instead of breaking the home view.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8488