summaryrefslogtreecommitdiffstats
path: root/news/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-10-31 06:56:52 +0100
committerDan McGee <dan@archlinux.org>2012-10-31 06:58:21 +0100
commit4122e97f7aa5ebb919c2afc88a3e548a2ab1e2aa (patch)
tree1d853cdcc373f767e398c2509d2571a19e229a8a /news/models.py
parentce5b0b2c5c10a3c840fd8aaa696ec2b8f403dc5b (diff)
downloadarchweb-4122e97f7aa5ebb919c2afc88a3e548a2ab1e2aa.tar.gz
archweb-4122e97f7aa5ebb919c2afc88a3e548a2ab1e2aa.tar.xz
Store 'safe_mode' attribute on news model
This lets us identify old news items that need to allow HTML through the markdown parser. For all new news items, we will disallow raw HTML. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'news/models.py')
-rw-r--r--news/models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/news/models.py b/news/models.py
index 55d3631..42adc19 100644
--- a/news/models.py
+++ b/news/models.py
@@ -16,13 +16,14 @@ class News(models.Model):
title = models.CharField(max_length=255)
guid = models.CharField(max_length=255, editable=False)
content = models.TextField()
+ safe_mode = models.BooleanField(default=True, editable=False)
def get_absolute_url(self):
return '/news/%s/' % self.slug
def html(self):
return mark_safe(markdown.markdown(
- self.content, safe_mode=False, enable_attributes=False))
+ self.content, safe_mode=self.safe_mode, enable_attributes=False))
def __unicode__(self):
return self.title