• 
      

    Fix issues caused by `unique` being a `cached_property`.

    Review Request #14745 — Created Dec. 23, 2025 and submitted

    Information

    Django Evolution
    master

    Reviewers

    Django 5.1 changed Field.unique to be @cached_property instead of
    @property. For sqlite, we were setting the internal _unique
    attribute, but with the caching, that wouldn't update. We therefore have
    to overwrite the public unique flag on newer versions, while still
    using _unique on 5.0 and below.

    Ran unit tests.

    Summary ID
    Fix issues caused by `unique` being a `cached_property`.
    Django 5.1 changed `Field.unique` to be `@cached_property` instead of `@property`. For sqlite, we were setting the internal `_unique` attribute, but with the caching, that wouldn't update. We therefore have to overwrite the public `unique` flag on newer versions, while still using `_unique` on 5.0 and below. Testing Done: Ran unit tests.
    krtrkkzxkoktvxqqyskwyqstktqulwuw
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (6ee547d)