From 306cb76e1c4966ecb118d1d7db456377ca61bab6 Mon Sep 17 00:00:00 2001 From: Anatoly Date: Mon, 16 Sep 2019 09:35:20 +0300 Subject: [PATCH] GM-25: Added comments --- apps/main/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/main/models.py b/apps/main/models.py index 82c155d7..d2a3dbb0 100644 --- a/apps/main/models.py +++ b/apps/main/models.py @@ -300,6 +300,7 @@ class Carousel(models.Model): @property def name(self): + # Check if Generic obj has name or title if hasattr(self.content_object, 'name'): return self.content_object.name if hasattr(self.content_object, 'title'): @@ -322,7 +323,9 @@ class Carousel(models.Model): @property def image(self): + # Check if Generic obj has an image if not hasattr(self.content_object.image, 'url'): + # Check if Generic obj has a FK to gallery return self.content_object.image.image.url return self.content_object.image.url