Add preview button in the Forum

This commit is contained in:
Skia
2017-04-12 19:19:25 +02:00
parent 830e94d73c
commit 3aa5070a38
4 changed files with 52 additions and 6 deletions

View File

@ -6,14 +6,14 @@ from rest_framework.views import APIView
from core.templatetags.renderer import markdown
@api_view(['GET'])
@api_view(['POST'])
@renderer_classes((StaticHTMLRenderer,))
def RenderMarkdown(request):
"""
Render Markdown
"""
try:
data = markdown(request.GET['text'])
data = markdown(request.POST['text'])
except:
data = 'Error'
return Response(data)