[PR #10281] [MERGED] 9231 fix empty search #13596

Closed
opened 2025-12-29 23:19:46 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/10281
Author: @arthanson
Created: 9/7/2022
Status: Merged
Merged: 9/7/2022
Merged by: @jeremystretch

Base: developHead: 9231-empty-search


📝 Commits (3)

📊 Changes

1 file changed (+7 additions, -0 deletions)

View changed files

📝 netbox/netbox/filtersets.py (+7 -0)

📄 Description

Fixes: #9231

See comment in code - The root issue I'm assuming is a change in Django initialization potentially. What is happening is the register_lookup for the CharField gets run in App.ready(), however this is being called after the FilterSet class constructer is being defined which is what sets up the filters (in self.base_filters) - so it is never getting setup.

This change re-inits the base_filters when the class is instantiated (after Empty has been registered) so it gets picked up correctly.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/10281 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 9/7/2022 **Status:** ✅ Merged **Merged:** 9/7/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `9231-empty-search` --- ### 📝 Commits (3) - [`536bd37`](https://github.com/netbox-community/netbox/commit/536bd37d05a8eeba6f17b64a5d0ad2a207063be8) #9231 make empty search work - [`2fe620d`](https://github.com/netbox-community/netbox/commit/2fe620df7019bf6eb6e5397b85f2e595e2b86768) #9231 call class method - [`48a907a`](https://github.com/netbox-community/netbox/commit/48a907ae4580f77eea74180c826952c8c3d3d5e7) #9231 add comment ### 📊 Changes **1 file changed** (+7 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/filtersets.py` (+7 -0) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to filing a pull request. This helps avoid wasting time and effort on something that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WE BE CLOSED AUTOMATICALLY. Specify your assigned issue number on the line below. --> ### Fixes: #9231 <!-- Please include a summary of the proposed changes below. --> See comment in code - The root issue I'm assuming is a change in Django initialization potentially. What is happening is the register_lookup for the CharField gets run in App.ready(), however this is being called after the FilterSet class constructer is being defined which is what sets up the filters ([in self.base_filters](https://github.com/carltongibson/django-filter/blob/main/django_filters/filterset.py#L62)) - so it is never getting setup. This change re-inits the base_filters when the class is instantiated (after Empty has been registered) so it gets picked up correctly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:19:46 +01:00
adam closed this issue 2025-12-29 23:19:46 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13596