在Django中,当请求来自angularjs的$http时,可以使用render_to_响应? 示例:
<!--proposta.html-->
<div ng-app='App' ng-controller="MyCtrl">
<input type="submit" value="Gerar" ng-click="post_dados(x)">
</div>
此按钮将参数传递给文件数据中post_dados()中的函数_应用程序js在
^{pr2}$在网址.py在
urlpatterns = patterns('',
url(r'^send_proposta/$', 'mge.core.views.send_proposta'),)
在视图.py在
def send_proposta(request):
proposta_tratada, header = tratar_proposta(request.POST)
if proposta_tratada=='erro':
json_erro=simplejson.dumps('Incorrect reporting of the Proposal, fill again')
return HttpResponse(json_erro, content_type ="application/json")
else:
table_edit=valido(proposta_tratada, header)
return render_to_response('rateio.html', {'x' : table_edit})
返回HttpResponse将消息发送到.success (function (return) {...}
,而{
是否可以使用响应u来呈现?如果可能,我怎么做?在
目前没有回答
相关问题 更多 >
编程相关推荐