From 481a932a70b4c9033c09a845384aac90e9f2a69c Mon Sep 17 00:00:00 2001 From: Leonardo Cavallucci Date: Sun, 15 Jun 2014 13:10:06 +0200 Subject: [PATCH] Fix get_image_url --- djangocms_blog/models.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 54a6d22..f32990e 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -114,7 +114,7 @@ class Post(ModelMeta, TranslatableModel): 'gplus_description': 'get_description', 'keywords': 'get_keywords', 'locale': None, - 'image': 'get_image_url', + 'image': 'get_image_full_url', 'object_type': settings.BLOG_TYPE, 'og_type': settings.BLOG_FB_TYPE, 'og_app_id': settings.BLOG_FB_APPID, @@ -142,8 +142,8 @@ class Post(ModelMeta, TranslatableModel): description = self.safe_translation_getter('abstract', any_language=True) return description.strip() - def get_image_url(self): - return self.main_image + def get_image_full_url(self): + return self.make_full_url(self.main_image.url) def get_tags(self): taglist = [tag.name for tag in self.tags.all()] @@ -189,11 +189,7 @@ class Post(ModelMeta, TranslatableModel): return settings.BLOG_IMAGE_FULL_SIZE def get_full_url(self): - s = Site.objects.get_current() - if s.domain.find('http') > -1: - return "%s%s" % (s.domain, self.get_absolute_url()) - else: - return "http://%s%s" % (s.domain, self.get_absolute_url()) + return self.make_full_url(self.get_absolute_url()) class LatestPostsPlugin(CMSPlugin):