##// END OF EJS Templates
Since we show sections on the landing page now, always show all tags in the tags view
Since we show sections on the landing page now, always show all tags in the tags view

File last commit:

r1601:24ed0df7 default
r1741:58ced8b0 default
Show More
preview.py
35 lines | 827 B | text/x-python | PythonLexer
from django.shortcuts import render
from django.template import RequestContext
from django.views.generic import View
from boards.mdx_neboard import Parser
FORM_QUERY = 'query'
CONTEXT_RESULT = 'result'
CONTEXT_QUERY = 'query'
__author__ = 'neko259'
TEMPLATE = 'boards/preview.html'
class PostPreviewView(View):
def get(self, request):
return render(request, TEMPLATE)
def post(self, request):
params = dict()
if FORM_QUERY in request.POST:
raw_text = request.POST[FORM_QUERY]
if len(raw_text) >= 0:
parser = Parser()
rendered_text = parser.parse(parser.preparse(raw_text))
params[CONTEXT_RESULT] = rendered_text
params[CONTEXT_QUERY] = raw_text
return render(request, TEMPLATE, params)