The Django template language is uploaded from the backend to the front end

Source: Internet
Author: User

If we need the template language to render the rendered HTML file to the front end when the backend has data dynamically extracted to the front end

The index function in our views.py has an S variable in the list that passes the data in curly braces to the {"list": s} to pass s to the list.

The place to add the HTML is to use 2 curly braces to introduce the

--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------

If we comment out s, use the S1 dictionary to pass

If you use a dictionary, the front end of {{}} is introduced dict.name with a period Fuga name

--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------

If we can use a lot of variables, then we do not need to directly pass parameters. Use locals () to refer to all variables. In the front page, you also use a period character to export the variable (list with index, dictionary with key)

The Django template language is passed from the backend to the front end

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: info-contact@alibabacloud.com 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.