How to render the detailed description of the tuples in Python Django

Source: Internet
Author: User

In Python Django, the actual application scheme for rendering the sequence of tuples is generally to render a relative dataset. The following article mainly introduces how to render the template in Python Django. I hope you will gain some benefits, the following is a detailed description of the article.

A general method of rendering a template is to render a dataset. Now we need to render the content output after a field is split.

View Layer Code:

 
 
  1. room = Agente.objects.get(id = t_id)  
  2. all_agent = room.package_dbname  
  3. output = all_agent.split(";")   

The serial number is composed of agent number_real name. py

 
 
  1. return render_to_response('moni/tagent.html',{'s_h':room,'output':output}) 

Template Layer Code:

 
 
  1. {% for type in output %}  
  2. <tr bgcolor="#EBF2F9" align=center> 
  3. <td align="center"> 
  4. <label>{{type}}</label> 
  5. </td>  

The Traversal method is actually the same as the method written in PY! One problem is that the last column is null during split. Filter required

Solution:

 
 
  1. result = output[0:len(output)-1] 

In this way, you can split the dataset to be traversed!



 

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.