Django common errors solution summary 1. Template type errors:
Error cause: return is missing in models:
Class UserProfile (models. Model ):
This is not a jump error, but I did not notice that my logon interface is in the form of ajax POST. the code is as follows:
// Log on to function _ submit () {var username = $ ("input [name = 'username']"). val (); var password = $ ("input [name = 'password']"). val (); if (username = "") {art. dialog ({content: 'user name cannot be blank ', time: 1.5});} else if (password = "") {art. dialog ({content: 'Password cannot be blank ', time: 1.5});} else {$. post ('/account/login/', {'username': username, 'password': password}, function (data) {if (data = 'error ') {art. dialog ({content: 'Incorrect user name or password ', time: 1.5 });}});}}
Query. post (url, [data], [callback], [type]):
If yes, it returns only one string. Therefore, you cannot jump in the background.
Solution: return HttpResponse ('OK'). you can jump to the frontend by accepting the returned OK.