summaryrefslogtreecommitdiff
path: root/news/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-10-26 17:36:12 -0500
committerDan McGee <dan@archlinux.org>2012-10-26 17:36:12 -0500
commit62bb3db8ada68a22c7a58f32b2e6bed63f19e53c (patch)
treef2239c8c288f9364527e53bb8a5bf6dde39f67af /news/models.py
parentbdee24b9d1279de67dd238e3644c2efff314bd7b (diff)
Remove usages of 'django.contrib.markup'
Switch to the news model being able to spit out the HTML version of the content, and don't use the markup contrib module. This is deprecated as of Django 1.5 so we can move off it now to save trouble down the road when it is fully removed. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'news/models.py')
-rw-r--r--news/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/news/models.py b/news/models.py
index 91232706..40238cde 100644
--- a/news/models.py
+++ b/news/models.py
@@ -1,6 +1,9 @@
+import markdown
+
from django.db import models
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
+from django.utils.safestring import mark_safe
from django.utils.timezone import now
@@ -17,6 +20,10 @@ class News(models.Model):
def get_absolute_url(self):
return '/news/%s/' % self.slug
+ def html(self):
+ return mark_safe(markdown.markdown(
+ self.content, safe_mode=True, enable_attributes=False))
+
def __unicode__(self):
return self.title