def add_appendix(request, topic_id): t = topic.objects.get(id=topic_id) n = t.node if request.user != t.user: return error(request, _('you cannot add appendix to other people\'s topic')) if request.method == 'GET': return render_to_response('forum/append.html', { 'request': request, 'title': _('add appendix'), 'node': n, 'conf': conf, 'topic': t, }, context_instance=RequestContext(request)) elif request.method == 'POST': a = appendix() a.content = request.POST['content'] if not a.content: messages.add_message(request, messages.WARNING, _('content cannot be empty')) return HttpResponseRedirect( reverse('add_appendix', kwargs={'topic_id': t.id})) a.topic = t a.save() return HttpResponseRedirect( reverse('topic_view', kwargs={'topic_id': t.id}))
def add_appendix(request, topic_id): t = topic.objects.get(id=topic_id) n = t.node if request.user != t.user: return error(request, u'请不要给其他用户的话题添加附言') if request.method == 'GET': return render_to_response('append.html', { 'request': request, 'title': u'添加附言', 'node': n, 'conf': conf, 'topic': t, }, context_instance=RequestContext(request)) elif request.method == 'POST': a = appendix() a.content = request.POST['content'] if not a.content: messages.add_message(request, messages.WARNING, u'内容不能为空') return HttpResponseRedirect( reverse('add_appendix', kwargs={'topic_id': t.id})) a.topic = t a.save() return HttpResponseRedirect( reverse('topic_view', kwargs={'topic_id': t.id}))
def add_appendix(request, topic_id): t = topic.objects.get(id=topic_id) n = t.node if request.user != t.user: return error(request, _('you cannot add appendix to other people\'s topic')) if request.method == 'GET': return render_to_response( 'forum/append.html', {'request': request, 'title': _('add appendix'), 'node': n, 'conf': conf, 'topic': t, }, context_instance=RequestContext(request)) elif request.method == 'POST': a = appendix() a.content = request.POST['content'] if not a.content: messages.add_message(request, messages.WARNING, _('content cannot be empty')) return HttpResponseRedirect( reverse('add_appendix', kwargs={'topic_id': t.id})) a.topic = t a.save() return HttpResponseRedirect( reverse('topic_view', kwargs={'topic_id': t.id}))
def add_appendix(request, topic_id): t = topic.objects.get(id=topic_id) n = t.node if request.user != t.user: return error(request,u'请不要给其他用户的话题添加附言') if request.method == 'GET': return render_to_response('append.html',{'request': request, 'title': u'添加附言', 'node': n, 'conf': conf, 'topic': t,}, context_instance=RequestContext(request)) elif request.method == 'POST': a = appendix() a.content = request.POST['content'] if not a.content: return error(request, u'请不要添加空内容') a.topic = t a.save() return HttpResponseRedirect(reverse('topic_view', kwargs={'topic_id': t.id}))