@login_required def submit(request): sajax.sajax_export(get_topic_list) ajax_response = sajax.sajax_handle_client_request(request) if ajax_response: return ajax_response manipulator = Article.AddManipulator() if request.POST: article_data = request.POST.copy() article_data["lang"] = request.LANGUAGE_CODE article_data["author"] = request.user.id errors = manipulator.get_validation_errors(article_data) if "body" in article_data and "body" not in errors: if len(article_data["body"]) < 200: errors["body"] = ["Your article was too short."] if not errors: manipulator.do_html2python(article_data) new_article = manipulator.save(article_data) return HttpResponseRedirect(new_article.get_absolute_url()) else: article_data = errors = {} form = forms.FormWrapper(manipulator, article_data, errors) extra_context = {'form': form, 'errors': errors} return render_template(request, 'articles/submit.html', extra_context)