Merge pull request #30 from protoroto/fix_image_url

Fix get_image_url
Tests TBA later
This commit is contained in:
Iacopo Spalletti 2014-06-20 18:26:58 +02:00
commit 5d1ba5e0f5

View file

@ -114,7 +114,7 @@ class Post(ModelMeta, TranslatableModel):
'gplus_description': 'get_description', 'gplus_description': 'get_description',
'keywords': 'get_keywords', 'keywords': 'get_keywords',
'locale': None, 'locale': None,
'image': 'get_image_url', 'image': 'get_image_full_url',
'object_type': settings.BLOG_TYPE, 'object_type': settings.BLOG_TYPE,
'og_type': settings.BLOG_FB_TYPE, 'og_type': settings.BLOG_FB_TYPE,
'og_app_id': settings.BLOG_FB_APPID, 'og_app_id': settings.BLOG_FB_APPID,
@ -142,8 +142,8 @@ class Post(ModelMeta, TranslatableModel):
description = self.safe_translation_getter('abstract', any_language=True) description = self.safe_translation_getter('abstract', any_language=True)
return description.strip() return description.strip()
def get_image_url(self): def get_image_full_url(self):
return self.main_image return self.make_full_url(self.main_image.url)
def get_tags(self): def get_tags(self):
taglist = [tag.name for tag in self.tags.all()] taglist = [tag.name for tag in self.tags.all()]
@ -189,11 +189,7 @@ class Post(ModelMeta, TranslatableModel):
return settings.BLOG_IMAGE_FULL_SIZE return settings.BLOG_IMAGE_FULL_SIZE
def get_full_url(self): def get_full_url(self):
s = Site.objects.get_current() return self.make_full_url(self.get_absolute_url())
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())
class LatestPostsPlugin(CMSPlugin): class LatestPostsPlugin(CMSPlugin):