From e65deb7d14a57ba788b978d50bd8198e659faa91 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 26 Feb 2024 05:20:16 +0000 Subject: [PATCH] Fixed #35246 -- Made Field.unique a cached property. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com> --- django/db/models/fields/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index cc5025af84bc..796c4d23c458 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -916,7 +916,7 @@ def get_db_converters(self, connection): return [self.from_db_value] return [] - @property + @cached_property def unique(self): return self._unique or self.primary_key