How to redirect from Django views to a specific view of angular JS

只愿长相守 提交于 2019-12-11 13:19:50

问题


I am working on something which has combo of Django and Angular JS. As the word goes, it little tricky to mix these two. I have everything working fine and so i decided to apply User Authentication. I have applied @login_required which redirects user to login page if not logged in , before checking out.

urls.py

url(r'^checkout/$','ecommerce.views.checkout'),

views.py

@login_required
   def checkout(request):
   return render_to_response('#checkout0',content_type="text")

app.js

 .when('/checkout0', {
            templateUrl: "../static/views/checkout-0.html",
            controller: "CartController"
 })

This anagular-routing is working absolutely fine when clicked through

<a href="#checkout0"> checkout </a>

How exactly to write return render_to_response('#checkout0',content_type="text") so that my page opens up with angular's checkout0 view. Any help

来源:https://stackoverflow.com/questions/33063810/how-to-redirect-from-django-views-to-a-specific-view-of-angular-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!