Preserve the model type in get_object_or_none().

Review Request #14511 — Created July 18, 2025 and submitted — Latest diff uploaded

Information

Djblets
release-5.x

Reviewers

get_object_or_none() now uses a TypeVar to type the returned object
as an instance of the provided model, preserving that type. This ensures
we don't end up with an Unknown 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.

Commits

Files