Fixes #21045: Allow saving Site with associated Prefix #669

Closed
opened 2026-04-05 17:05:13 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @jnovinger on 12/30/2025

Fixes: #21045

This was a result of the fix for #20944 optimizing a query to only include the id field with .only(id). Since Prefix.__init__() caches original values from other fields (_prefix and _vrf_id), these cached values are None at init-time.

This might not normally be a problem, but the sequence of events in the bug report also end up causing the handle_prefix_saved handler to run, which uses an ORM lookup, (either net_contained_or_equal originalnet_contained) that does not support a query argument of None.

*Originally created by @jnovinger on 12/30/2025* ### Fixes: #21045 This was a result of the fix for #20944 optimizing a query to only include the `id` field with `.only(id)`. Since `Prefix.__init__()` caches original values from other fields (`_prefix` and `_vrf_id`), these cached values are `None` at init-time. This might not normally be a problem, but the sequence of events in the bug report also end up causing the `handle_prefix_saved` handler to run, which uses an ORM lookup, (either `net_contained_or_equal` original`net_contained`) that does not support a query argument of `None`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#669