• 
      

    Preserve the model type in get_object_or_none().

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

    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.

    Summary ID
    Preserve the model type in get_object_or_none().
    `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.
    c6df45de6815e1e4336944489d6509a456d2aece
    david
    1. Ship It!
    2. 
        
    maubin
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.x (98e6e0f)