Fixes #21160: Handle "null" choice selection in widgets #514

Closed
opened 2026-04-05 16:38:50 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @pheus on 1/20/2026

Fixes: #21160

This PR addresses a regression introduced by the performance changes in #21200: selecting the “None”/null tenant option (e.g. tenant_id=null) could raise Field 'id' expected a number but got 'null' during widget rendering.

The widget now filters out the null sentinel before querying for selected PKs, while still preserving the “None” option in the rendered select (including mixed selections like [<pk>, null]). Regression tests have been added to cover both the null-only and mixed-selection cases.

Thanks to everyone who worked on the performance improvements! This is a small follow-up to keep the previous filtering behavior intact. 🙏

*Originally created by @pheus on 1/20/2026* ### Fixes: #21160 This PR addresses a regression introduced by the performance changes in #21200: selecting the **“None”/null** tenant option (e.g. `tenant_id=null`) could raise `Field 'id' expected a number but got 'null'` during widget rendering. The widget now filters out the null sentinel before querying for selected PKs, while still preserving the “None” option in the rendered select (including mixed selections like `[<pk>, null]`). Regression tests have been added to cover both the null-only and mixed-selection cases. Thanks to everyone who worked on the performance improvements! This is a small follow-up to keep the previous filtering behavior intact. 🙏
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#514