def publish(request): login_value = get_login_value(request) if login_value['state'] == 2: return HttpResponseRedirect("../home") if request.method == 'POST': article = Article() article.title = request.POST['title'] article.category = request.POST['category'] article.introduction = request.POST['description'] html = request.POST['markdown'].replace(' ', ' ').replace('\\n', '\n').replace('<', '<').replace('>', '>') html = append_script(html) article.content = html article.save() return HttpResponseRedirect("../user") else: return HttpResponseRedirect("../home")
def publish(request): logging_status = get_logging_status(request) if logging_status['login_state'] == BLOGSETTING.UNLOGGED: return HttpResponseRedirect("../home") if request.method == 'POST': article = Article() article.title = request.POST['title'] article.category = request.POST['category'] article.introduction = request.POST['description'] html = request.POST['html'].replace(' ', ' ').replace('\\n', '\n') \ .replace('<', '<').replace('>', '>') html = append_script(html) markdown = request.POST['markdown'].replace(' ', ' ').replace('\\n', '\n') \ .replace('<', '<').replace('>', '>') article.markdown = markdown article.content = html article.save() return HttpResponseRedirect("../user") else: return HttpResponseRedirect("../home")