summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/blog/models.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/apps/blog/models.py b/apps/blog/models.py
index 65c0149..d93a3ff 100644
--- a/apps/blog/models.py
+++ b/apps/blog/models.py
@@ -111,16 +111,12 @@ class Entry(models.Model):
return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date
def get_thumbnail_url(self):
- if settings.DEVELOPMENT == True:
- return '%s%s' %(settings.IMAGES_URL, self.thumbnail.url[35:])
- else:
- return '%s%s' %(settings.IMAGES_URL, self.thumbnail.url[33:])
+ image_dir, img = self.thumbnail.url.split('post-thumbnail/')[1].split('/')
+ return '%spost-thumbnail/%s/%s' %(settings.IMAGES_URL, image_dir, img)
def get_image_url(self):
- if settings.DEVELOPMENT == True:
- return '%s%s' %(settings.IMAGES_URL, self.image.url[35:])
- else:
- return '%s%s' %(settings.IMAGES_URL, self.image.url[33:])
+ image_dir, img = self.image.url.split('post-images/')[1].split('/')
+ return '%spost-images/%s/%s' %(settings.IMAGES_URL, image_dir, img)
def save(self):
html,lede = markdown_processor(self.body_markdown)