From f0585b3ebcc7c6667e8db4c1054be0de5133400f Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Tue, 17 Dec 2019 18:37:51 +0300 Subject: [PATCH] fix carousel slugs --- apps/main/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/main/models.py b/apps/main/models.py index 9b778834..2302dec3 100644 --- a/apps/main/models.py +++ b/apps/main/models.py @@ -279,6 +279,11 @@ class Carousel(models.Model): @property def slug(self): + if hasattr(self.content_object, 'slugs'): + try: + return next(iter(self.content_object.slugs.values())) + except StopIteration: + return None if hasattr(self.content_object, 'slug'): return self.content_object.slug