From 0a5af976b885d58170b8d66dcf4df8d60355fa49 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 8 Jan 2025 18:38:35 +0530 Subject: [PATCH] cached property --- content/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/models.py b/content/models.py index 70a3e16..b4330e4 100644 --- a/content/models.py +++ b/content/models.py @@ -8,6 +8,7 @@ from django.utils.html import mark_safe from django.utils.encoding import python_2_unicode_compatible from django.db.models.signals import m2m_changed from django.dispatch import receiver +from django.utils.functional import cached_property from photologue.models import Photo, Gallery @@ -155,7 +156,7 @@ class Content(models.Model): if src: return mark_safe(u''.format(self.get_absolute_url(), src)) - @property + @cached_property def image_url(self): if self.photo: url = self.photo.image.url