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

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

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
Checks run (2 succeeded)
flake8 passed.
JSHint passed.
chipx86
  1. Ship It!
  2.