summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2010-11-19 16:17:09 -0500
committerluxagraf <sng@luxagraf.net>2010-11-19 16:17:09 -0500
commit92d073f2981d14bf0605c26003709e78ad70423e (patch)
treee18928fc60f1891289b4ed281333b0c7293d0315 /apps
parente75aa2759bc9478d9608dab6761ec39b5012b1d7 (diff)
made image fetching function path-relative
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)