Skip to content

CircuitGroupAssignmentTable FieldError when sorting by member column (GenericForeignKey missing orderable=False) #21749

@clovehitch

Description

@clovehitch

NetBox Edition

NetBox Community

NetBox Version

4.4.10

Python Version

3.12

Steps to Reproduce

  1. Log in as a superuser
  2. Create a Provider, Circuit Type, and Circuit
  3. Create a Circuit Group
  4. Create a Circuit Group Assignment (member type: Circuit, member: the circuit created above)
  5. Create a non-superuser with staff status
  6. Create an object permission granting view on circuits | circuit group assignment and assign it to the user
  7. Log in as the non-superuser
  8. Navigate to /circuits/circuit-group-assignments/
  9. Click the "Circuit" column header to sort by it
  10. Alternatively, navigate directly to /circuits/circuit-group-assignments/?sort=member

Expected Behavior

The table sorts by the Circuit column without error.

Observed Behavior

django.core.exceptions.FieldError: Field 'member' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation.

The sort preference is saved to the user's config, so all subsequent page loads also fail. Superusers are not affected.

The member column on CircuitGroupAssignmentTable is a GenericForeignKey but is missing orderable=False. This is the same bug fixed for CircuitTerminationTable and TunnelTerminationTable in commit 95d0ca5 (PR #19600 / #19487), but CircuitGroupAssignmentTable was not included in that fix.

Metadata

Metadata

Assignees

Labels

netboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions