Filtering on null values for nullable CharFields is broken #2382

Closed
opened 2025-12-29 17:25:32 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Feb 14, 2019).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.6

Steps to Reproduce

  1. Attempt to filter the racks list by null facility_id value:

http://netbox/dcim/racks/?facility_id=null

Expected Behavior

Only racks with a null facility_id should be returned.

Observed Behavior

The filter has no effect. There are two issues at play here.

First, NullableCharFieldFilter is looking for a query parameter of NULL rather than null as specified in settings.py. Second, if NULL is passed, an exception occurs due to the filter using obsolete syntax: self.name should be self.field_name.

Originally created by @jeremystretch on GitHub (Feb 14, 2019). ### Environment * Python version: 3.5.2 * NetBox version: 2.5.6 ### Steps to Reproduce 1. Attempt to filter the racks list by null `facility_id` value: `http://netbox/dcim/racks/?facility_id=null` <!-- What did you expect to happen? --> ### Expected Behavior Only racks with a null `facility_id` should be returned. <!-- What happened instead? --> ### Observed Behavior The filter has no effect. There are two issues at play here. First, NullableCharFieldFilter is looking for a query parameter of `NULL` rather than `null` as specified in settings.py. Second, if `NULL` is passed, an exception occurs due to the filter using obsolete syntax: `self.name` should be `self.field_name`.
adam added the type: bugstatus: accepted labels 2025-12-29 17:25:32 +01:00
adam closed this issue 2025-12-29 17:25:32 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2382