Django common error solutions

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.