[Python] [Django Learning Article] [10] Edit the blog homepage template again

Source: Internet
Author: User

What we're seeing is just some pre-populated data in the template, and we have to let it show the data from the database for the article. Here's a little makeover for the template:

Remove all article tags, and then add the following to populate the template variable {{post_list}} with the content read from the database

{% forPostinchPost_list%}                <articleclass="post post-{{post.pk}}"> class="Entry-header"> class="Entry-title"> <a href="single.html">{{post.title}}</a> class="Entry-meta"> <spanclass="post-category"><a href="#">{{post.category.name}}</a></span> <spanclass="post-date"><a href="#"><timeclass="entry-date"datetime="{{Post.create_time}}">2017 May 11 </time></a></span> <spanclass="Post-author"><a href="#">{{Post.author}}</a></span> <spanclass="Comments-link"><a href="#">4 Reviews </a></span> <spanclass="Views-count"><a href="#">588 reading </a></span> </div> class="entry-content Clearfix"> <p>{{post.excerpt}}</p> <divclass="Read-more cl-effect-14"> <a href="#" class="More-link"> Continue reading <spanclass="Meta-nav">→</span></a> </div> </div> </artic Le>                {% EMPTY%}                    <divclass="No-post"> not yet published articles! </div>                {% ENDFOR%}

[Python] [Django Learning Article] [10] Edit the blog homepage template again

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.