Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting Jobs table by object causes FieldError #14223

Closed
cpmills1975 opened this issue Nov 8, 2023 · 1 comment · Fixed by #14226
Closed

Sorting Jobs table by object causes FieldError #14223

cpmills1975 opened this issue Nov 8, 2023 · 1 comment · Fixed by #14226
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@cpmills1975
Copy link
Contributor

NetBox version

v3.6.4

Python version

3.8

Steps to Reproduce

  1. Browse to /core/jobs
  2. Click on the 'object' heading in the table, observe nothing happens (HTMX request results in 500 server error, but this is not visible - see below)
  3. Try and reload the page, observe that an exception is thrown and all further attempts to view the Job listing page results in the same exception:

<class 'django.core.exceptions.FieldError'>

Field 'object' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation.

Python version: 3.8.10
NetBox version: 3.6.4
Plugins:
netbox_demo: 0.3.1

When attempting to sort by object, Django will throw a FieldError meaning the HTMX request appears to do nothing. The error can be observed in the browser console. Subsequently, the FieldError becomes visible when reloading the page, because sorting by object is now stored in the user's preferences.

In case anyone stumbles across this, the fix is to remove the table configuration for the JobTable from the user preferences or remove the ordering by appending ?sort= to the /core/jobs URL.

Expected Behavior

The Jobs list should either return a list sorted by the object, or shouldn't allow the table to be sorted by the object field at all.

Observed Behavior

A FieldError exception is raised.

@cpmills1975 cpmills1975 added the type: bug A confirmed report of unexpected behavior in the application label Nov 8, 2023
cpmills1975 added a commit to cpmills1975/netbox that referenced this issue Nov 9, 2023
@cpmills1975
Copy link
Contributor Author

cpmills1975 commented Nov 9, 2023

I've raised PR #14226 for this if you are happy to accept?

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available labels Nov 9, 2023
jeremystretch pushed a commit that referenced this issue Nov 9, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
2 participants