summaryrefslogtreecommitdiff
path: root/app/posts
diff options
context:
space:
mode:
Diffstat (limited to 'app/posts')
-rw-r--r--app/posts/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/posts/models.py b/app/posts/models.py
index c686070..d0e8c0b 100644
--- a/app/posts/models.py
+++ b/app/posts/models.py
@@ -162,6 +162,16 @@ class Post(models.Model):
else:
return 0.7
+ def get_image_url(self):
+ '''
+ for legacy jrnl posts without a featured_image
+ '''
+ try:
+ image_dir, img = self.old_image.url.split('post-images/')[1].split('/')
+ return '%spost-images/%s/%s' % (settings.IMAGES_URL, image_dir, img)
+ except ValueError:
+ pass
+
def save(self, *args, **kwargs):
created = self.pk is None
if not created: