summaryrefslogtreecommitdiff
path: root/app/src/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-12-03 16:24:36 -0500
committerluxagraf <sng@luxagraf.net>2015-12-03 16:24:36 -0500
commite4a7f290d373427c36d7925e7381aadf16524936 (patch)
treef38fe76393ddac2d77f653a109ac360fa2fb75d1 /app/src/models.py
parent657d719bfdc33c8b01a430ea3f58a4907c558f9d (diff)
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.
Diffstat (limited to 'app/src/models.py')
-rw-r--r--app/src/models.py39
1 files changed, 27 insertions, 12 deletions
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