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

Object types are not filtered appropriately when filtering custom fields #11786

Closed
jeremystretch opened this issue Feb 19, 2023 · 0 comments
Closed
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@jeremystretch
Copy link
Member

jeremystretch commented Feb 19, 2023

NetBox version

v3.4.4

Python version

3.8

Steps to Reproduce

  1. View the custom fields list in the UI
  2. Select the "filters" tab
  3. Open the "object type" filter dropdown

Expected Behavior

Only relevant object types (those to which custom fields can be assigned) should be included in the list.

Observed Behavior

All known object types are listed. (This affects several other models too, in addition to custom fields.)

It appears that Django does not acknowledge limit_choices_to when set on fields on non-model forms. Apparently this has never actually been a documented kwarg for ModelChoiceField; its acceptance as a keyword argument seems to be incidental to support for the attribute on ForeignKey models fields.

We'll need to devise an alternative solution for filtering ModelChoiceFields on non-model forms (e.g. CustomFieldFilterForm).

@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Feb 19, 2023
@jeremystretch jeremystretch self-assigned this Feb 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

1 participant