From 2ba01376a72572bd98d5f4c4236650e647d9bba7 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 30 Apr 2016 16:16:40 +0200 Subject: [PATCH] Make rendering the markdown actually abstractable. Even after e35c1aa0c4b4f1c3e1d2122ead21e72c555d55f9, `MarkdownifyView` is still hardcoded to call `markdownx.utils.mardownify`, regardless of the value of `MARKDOWNX_MARKDOWNIFY_FUNCTION`. This commit calls the function designated by that setting instead. --- markdownx/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/markdownx/views.py b/markdownx/views.py index 1de7c72..a57933a 100755 --- a/markdownx/views.py +++ b/markdownx/views.py @@ -1,13 +1,15 @@ -from django.views.generic.edit import View, FormView +from django.conf import settings from django.http import HttpResponse, JsonResponse +from django.utils.module_loading import import_string +from django.views.generic.edit import View, FormView from .forms import ImageForm -from .utils import markdownify class MarkdownifyView(View): def post(self, request, *args, **kwargs): + markdownify = import_string(settings.MARKDOWNX_MARKDOWNIFY_FUNCTION) return HttpResponse(markdownify(request.POST['content']))