Preserve the model type in get_object_or_none().
Review Request #14511 — Created July 18, 2025 and submitted — Latest diff uploaded
get_object_or_none()
now uses aTypeVar
to type the returned object
as an instance of the provided model, preserving that type. This ensures
we don't end up with anUnknown
type that we then have to manually map
to a type.
Unit tests pass.
Verified the typing of the returned object was correct when using the
function.