diff options
Diffstat (limited to 'app/pages/models.py')
-rw-r--r-- | app/pages/models.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/app/pages/models.py b/app/pages/models.py index fcc0e5a..2462b06 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -1,38 +1,31 @@ -import datetime from django.db import models -from django.conf import settings from django.contrib.sitemaps import Sitemap - import markdown -def markdown_processor(md): - return markdown.markdown(md, ['footnotes'],safe_mode = False) -TEMPLATES = ( - (0, 'single'), - (1, 'double'), - (2, 'single-dark'), - (3, 'double-dark'), - ) - +def markdown_processor(md): + return markdown.markdown(md, ['footnotes'], safe_mode=False) + + class Page(models.Model): title = models.CharField(max_length=200) slug = models.SlugField() body_html = models.TextField(blank=True) body_markdown = models.TextField() meta_description = models.CharField(max_length=256, null=True, blank=True) - + def __unicode__(self): return self.title def get_absolute_url(self): return "/%s/" % (self.slug) - - def save(self): + + def save(self): #run markdown self.body_html = markdown_processor(self.body_markdown) super(Page, self).save() + class PageSitemap(Sitemap): changefreq = "never" priority = 1.0 |