diff options
author | Dan McGee <dan@archlinux.org> | 2014-12-08 19:52:55 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2014-12-08 19:52:55 -0600 |
commit | 60327d96a687669d8b8842ecf0ac16c11a8f6483 (patch) | |
tree | fe8f5a15f994fd21251bcd9dd41f62e76a7958ad /news | |
parent | 9faa6d580e73adfe0f3a194b09d7f6b91b80aae9 (diff) |
Upgrade to python-markdown 2.5.2
safe_mode is now deprecated, so adjust things accordingly.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'news')
-rw-r--r-- | news/models.py | 7 | ||||
-rw-r--r-- | news/views.py | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/news/models.py b/news/models.py index 985c1088..a66da8d4 100644 --- a/news/models.py +++ b/news/models.py @@ -1,11 +1,11 @@ -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 +from main.utils import parse_markdown + class News(models.Model): slug = models.SlugField(max_length=255, unique=True) @@ -22,8 +22,7 @@ class News(models.Model): return '/news/%s/' % self.slug def html(self): - return mark_safe(markdown.markdown( - self.content, safe_mode=self.safe_mode, enable_attributes=False)) + return mark_safe(parse_markdown(self.content, not self.safe_mode)) def __unicode__(self): return self.title diff --git a/news/views.py b/news/views.py index ca4fdf97..274ba75d 100644 --- a/news/views.py +++ b/news/views.py @@ -1,5 +1,3 @@ -import markdown - from django import forms from django.http import HttpResponse from django.shortcuts import get_object_or_404, redirect @@ -8,7 +6,7 @@ from django.views.generic import (DetailView, ListView, CreateView, UpdateView, DeleteView) from .models import News -from main.utils import find_unique_slug +from main.utils import find_unique_slug, parse_markdown class NewsForm(forms.ModelForm): @@ -62,7 +60,7 @@ def view_redirect(request, object_id): @require_POST def preview(request): data = request.POST.get('data', '') - markup = markdown.markdown(data, safe_mode=True, enable_attributes=False) + markup = parse_markdown(data) return HttpResponse(markup) # vim: set ts=4 sw=4 et: |