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

Support filter lookups for custom fields #6615

Closed
jeremystretch opened this issue Jun 16, 2021 · 0 comments
Closed

Support filter lookups for custom fields #6615

jeremystretch opened this issue Jun 16, 2021 · 0 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Milestone

Comments

@jeremystretch
Copy link
Member

NetBox version

v2.11.6

Feature type

Change to existing functionality

Proposed functionality

Extend NetBox's filtering functionality to automatically generate lookup filters for a model's custom fields. For example, a custom field named foo applied to the dcim.Site model will result in a filter named cf_foo on SiteFilterSet. This filter will support either an exact match or an icontains lookup, depending on how the CustomField is configured. However, it will not support any further lookup logic, such as greater/less than evaluation for integers.

Implementing this feature would comprise automatically generating appropriate lookups for a custom field depending on its type. For example, integer fields should get __lt, __lte, __gt, __gte, and similar lookups. This might be done by extending either BaseFilterSet or the CustomFieldFilter class,

Use case

This extension of the existing filtering logic would enable users to filter on custom fields with the same degree of flexibility afforded to built-in model fields.

Database changes

No response

External dependencies

No response

@jeremystretch jeremystretch added the type: feature Introduction of new functionality to the application label Jun 16, 2021
@jeremystretch jeremystretch added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Jul 1, 2021
@jeremystretch jeremystretch added needs milestone Awaiting prioritization for inclusion with a future NetBox release and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Aug 4, 2021
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed needs milestone Awaiting prioritization for inclusion with a future NetBox release labels Sep 9, 2021
@jeremystretch jeremystretch added this to the v3.1 milestone Sep 9, 2021
@jeremystretch jeremystretch self-assigned this Oct 28, 2021
jeremystretch added a commit that referenced this issue Oct 29, 2021
Closes #6615: Enable filter lookups for custom fields
sol1james added a commit to sol1james/netbox that referenced this issue Dec 20, 2021
Netbox now supports lookup expressions on custom fields

netbox-community#6615
sol1james added a commit to sol1james/netbox that referenced this issue Jan 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2022
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: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

1 participant