jquery - Ajax call to django @login_required view returns login page if user had logged out -
if wrap view function in @login_required , call using $.ajax({...}) , user has logged out (from tab example), success() call called , data content of login page redirect.
is there way @login_required decorator return error code if it's ajax request rather redirect, can correctly redirect in javascript?
this post (what's best way handle session timeouts in ajax requests?) indicated have write on @login_required decorator... isn't there way handle within core django?
check out permission_required decorator. can set return 403 error code instead of login page redirect.
Comments
Post a Comment