1

私はメザニンを初めて使用します。djangoアプリのrelativesフォルダーにテンプレートと静的ファイルをコピーするだけで、カスタムブートストラップテーマをインストールできました。

私のindex.htmlに、次のようなブログエントリがあると仮定します

<h2>Other Entries</h2>
<article>
<h3>Blog Post 1</h3>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text.... <a href="#">Read more</a></p>
</article>
<article>
<h3>Blog Post 2</h3>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text.... <a href="#">Read more</a></p>
</article>
<article>
<h3>Blog Post 3</h3>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text.... <a href="#">Read more</a></p>
</article>

以前に管理ページに挿入したブログ エントリを取得するにはどうすればよいですか?

ありがとう

4

1 に答える 1

3

テンプレートの上部に次のように入力します。

{% load blog_tags %}

次に、ブログ投稿を表示したい場所に、次のようなものを置きます

{% blog_recent_posts as recent_posts %}
{% for blog_post in recent_posts %}
<h3>{{ blog_post.title }}</h3>
{{ blog_post.description_from_content|truncatewords_html:10|safe }}
<a href="{{ blog_post.get_absolute_url }}">Read more</a>
</article>
{% endfor %}

恥知らずなプラグイン: Mezzanine のテーマを作成するプロセスを説明する一連のブログ投稿を書いている最中です。それをチェックしてください、http://bitofpixels.com/blog/mezzatheming-creating-mezzanine-themes-part-1-basehtml/

于 2013-09-18T05:01:33.920 に答える