def add(request, id): if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): post = Topic.objects.get(pk=id) comment = Comment() comment.topic = post comment.author = request.user comment.content = text_markup.render( form.cleaned_data['content'] ) comment.raw_content = form.cleaned_data['content'] comment.community = post.community comment.community_widget = post.community_widget comment.save() post.save() return HttpResponseRedirect(request.META['HTTP_REFERER']) return HttpResponseNotFound()
def auth(request): context = {} context['auth'] = Topic.get_auth_class().get_auth() context['auth_comment'] = Comment.get_auth_class().get_auth() return context