python - Display data from a table using Django -


Can someone give me a small piece code, where we display data from a table and point me into that code Which do views.py and template / index

It shows, in 4 parts, the basics of this structure

For your question, a very quick example.

In views.py:

  DIF display (request): return to render_to_response ('template .tmpl', {'obj': models.book.objects.all ( In model:  
  class book (model. Model): author = model.carfield (max_land = 20) title = model. Kharefild (maximum_long = 40) publishing_en = model.tectorfield ()  

in template .tmp:

   {{B.author}} & lt; / Td> & Lt; Td> {{B.title}} & lt; / Td> & Lt; Td> {{B.publication_year}} & lt; / Td> & Lt; / TR & gt; {% Endfor%} & lt; / Table & gt;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -