diff options
author | luxagraf <sng@luxagraf.net> | 2016-11-02 12:44:30 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2016-11-02 12:44:30 -0400 |
commit | df8c450c5ee993bf997e3ae9de52e8b1c91e91d6 (patch) | |
tree | 9c7f22bfda9ac2508ef49b02c053f969262f6f29 /app/pages | |
parent | 9a044c66c5f2e201ac4d264909e8f8b62e288818 (diff) |
launched new homepage and misc improvements
Diffstat (limited to 'app/pages')
-rw-r--r-- | app/pages/models.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/pages/models.py b/app/pages/models.py index 0bbd069..4d06e7c 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -1,7 +1,13 @@ +import re from django.db import models from django.contrib.sitemaps import Sitemap from utils.widgets import markdown_to_html +from utils.widgets import parse_image + +def render_images(s): + s = re.sub('<img(.*)/>', parse_image, s) + return s class Page(models.Model): @@ -24,7 +30,8 @@ class Page(models.Model): def save(self): # run markdown - self.body_html = markdown_to_html(self.body_markdown) + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) super(Page, self).save() |