diff options
author | luxagraf <sng@luxagraf.net> | 2011-01-20 11:27:12 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2011-01-20 11:29:51 -0600 |
commit | d594e5dac52b2c3c4b8e462aa6f2c11d30165d28 (patch) | |
tree | b9598b3bca38b767d8737747e14f822e0337d7c3 /apps/blog/models.py | |
parent | 205fc827ef1dd21acc95139fca57651c9baccb2d (diff) |
changed path for thumbnail images
Diffstat (limited to 'apps/blog/models.py')
-rw-r--r-- | apps/blog/models.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/blog/models.py b/apps/blog/models.py index 7b01eb7..1026dc0 100644 --- a/apps/blog/models.py +++ b/apps/blog/models.py @@ -19,6 +19,10 @@ def get_upload_path(self, filename): def get_tn_path(self, filename): return "images/post-thumbnail/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename) +def image_url_replace(str): + str = str.replace('[[base_url]]', settings.IMAGES_URL) + #print str + return str def markdown_processor(md): processed = markdown.markdown(md, ['footnotes'],safe_mode = False).split('<break>') @@ -111,15 +115,16 @@ class Entry(models.Model): return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date def get_thumbnail_url(self): - image_dir, img = self.thumbnail.url.split('post-thumbs/')[1].split('/') - return '%spost-thumbs/%s/%s' %(settings.IMAGES_URL, image_dir, img) + 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): 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) + md = image_url_replace(self.body_markdown) + html,lede = markdown_processor(md) self.body_html = html self.lede = lede self.dek == markdown.markdown(self.dek, safe_mode = False) |