summaryrefslogtreecommitdiff
path: root/app/guide/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/guide/models.py')
-rw-r--r--app/guide/models.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/guide/models.py b/app/guide/models.py
index 4108e27..7f0d501 100644
--- a/app/guide/models.py
+++ b/app/guide/models.py
@@ -5,13 +5,13 @@ from django.contrib.sitemaps import Sitemap
from django.contrib.syndication.views import Feed
from PIL import Image
-
-import markdown
from taggit.managers import TaggableManager
from locations.models import Location
from jrnl.models import Entry
from photos.models import PhotoGallery
+from utils.widgets import markdown_to_html
+
def get_upload_path(self, filename):
return "images/guide-images/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename)
@@ -27,7 +27,7 @@ def image_url_replace(str):
def markdown_processor(md):
- return markdown.markdown(md, ['footnotes'], safe_mode=False)
+ return markdown_to_html(md)
class Guide(models.Model):
@@ -90,17 +90,14 @@ class Guide(models.Model):
return '%sguide-images/%s/%s' % (settings.IMAGES_URL, image_dir, img)
def save(self):
- #get image dimensions
if self.image:
img = Image.open(self.image)
self.image_width, self.image_height = img.size
- #same for thumb
img = Image.open(self.thumbnail)
self.thumb_width, self.thumb_height = img.size
md = image_url_replace(self.body_markdown)
- #run markdown
- self.body_html = markdown_processor(md)
- self.dek = markdown.markdown(self.dek, safe_mode=False)
+ self.body_html = markdown_to_html(md)
+ self.dek = markdown_to_html(self.dek)
super(Guide, self).save()