def post_conversation(request): assert(request.method=='POST' and request.is_ajax()==True) related_topic = Topic.objects.get(pk=int(request.POST['id'])) topic = Topic(content=request.POST['content'], author=request.user,conversation=related_topic) topic.save() response = HttpResponse(cgi.escape(topic.content)) return response
def post_topic(request): assert(request.method=='POST' and request.is_ajax()==True) content = smart_unicode(request.raw_post_data) topic = Topic(content=content, author=request.user) topic.save() response = HttpResponse(cgi.escape(topic.content)) return response
def post_topic(request): assert (request.method == 'POST' and request.is_ajax() == True) content = smart_unicode(request.raw_post_data) topic = Topic(content=content, author=request.user) topic.save() response = HttpResponse(cgi.escape(topic.content)) return response
def post_conversation(request): assert (request.method == 'POST' and request.is_ajax() == True) related_topic = Topic.objects.get(pk=int(request.POST['id'])) topic = Topic(content=request.POST['content'], author=request.user, conversation=related_topic) topic.save() response = HttpResponse(cgi.escape(topic.content)) return response
def post_topic(request): """ 用于接收用户最新发表的微博保存到数据库中 利用ajax传递 不刷新页面 assert函数用来检测是否符合条件 """ assert(request.method=='POST' and request.is_ajax()==True) content = smart_unicode(request.raw_post_data) topic = Topic(content=content, author=request.user) topic.save() response = HttpResponse(cgi.escape(topic.content)) return response