From e4a7f290d373427c36d7925e7381aadf16524936 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Thu, 3 Dec 2015 16:24:36 -0500 Subject: switched over to using a single markdown processor from utils everywhere except notes because I'm urlizing notes and I don't want to do that anywhere else. --- app/src/models.py | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'app/src') diff --git a/app/src/models.py b/app/src/models.py index 10df6b2..2b36fab 100644 --- a/app/src/models.py +++ b/app/src/models.py @@ -6,6 +6,8 @@ import markdown import datetime from itertools import chain +from utils.widgets import markdown_to_html + class Topic(models.Model): name = models.CharField(max_length=60) @@ -71,12 +73,7 @@ class Entry(models.Model): def save(self): md = image_url_replace(self.body_markdown) - self.body_html = markdown.markdown(md, extensions=[ - 'markdown.extensions.codehilite(css_class=highlight,linenums=False)', - 'markdown.extensions.fenced_code', - 'markdown.extensions.attr_list', - 'extra' - ], safe_mode=False) + self.body_html = markdown_to_html(md) super(Entry, self).save() @@ -129,15 +126,33 @@ class Book(models.Model): def save(self): md = image_url_replace(self.body_markdown) - self.body_html = markdown.markdown(md, extensions=[ - 'markdown.extensions.codehilite(css_class=highlight,linenums=False)', - 'markdown.extensions.fenced_code', - 'markdown.extensions.attr_list', - 'extra' - ], safe_mode=False) + self.body_html = markdown_to_html(md) super(Book, self).save() +'''class SrcDemo(models.Model): + title = models.CharField(max_length=254) + slug = models.SlugField() + body = models.TextField(blank=True, null=True) + head = models.TextField(blank=True, null=True) + DEMO_TEMPLATES = ( + (0, 'Blank'), + (1, 'Basic_light'), + ) + template = models.IntegerField(choices=DEMO_TEMPLATES, default=0) + pub_date = models.DateTimeField('Date published', blank=True) + + class Meta: + verbose_name_plural = "Demos" + app_label = 'projects' + ordering = ('-pub_date',) + + def save(self): + if not self.id: + self.pub_date = datetime.datetime.now() + super(SrcDemo, self).save() +''' + class SrcSitemap(Sitemap): changefreq = "never" priority = 0.7 -- cgit v1.2.3