You could also make use of the mezzanine.core.models.MetaData.description
field. core.Displayable extends MetaData and pages.Page extends Displayable
so it is pretty much available everywhere and should already be populated
in the database, instead of having to compute it.
Le samedi 23 mai 2015 03:11:07 UTC+2, Danny S a écrit :
>
> On 23/05/2015 9:12 AM, Jean de la Croix Ki wrote:
> > Hi group;
> > I want to know how is it possible to create page and just put it
> > summary and a link to it on my home page. How to achieve this ?
> >
>
> My home page shows some of the summaries of the blog posts on the front
> page - you could probably do this in your template
> for other pages as well. The key thing, I think, is the
> 'truncatewords_html' filter that Django provides, it allows you show a
> short snippet from another page/other content.
>
> In my index.html template:
>
> {% block main %}
>
> {% blog_recent_posts 3 as recent_posts %}
> {% if recent_posts %}
> <div class="panel">
> <h2><a href="/blog">Latest News</a></h2>
> {% for blog_post in recent_posts %}
> <h3>
> <a href="{{ blog_post.get_absolute_url }}">{{ blog_post.title }}</a>
> </h3>
> <h6 class="post-meta">
> {% trans "Posted by" %}: {% with blog_post.user as author %} <a
> href="{% url "blog_post_list_author" author %}">{{
> author.get_full_name|default:author.username }}</a> {% endwith %}
> {% blocktrans with sometime=blog_post.publish_date|timesince %}{{
> sometime }} ago{% endblocktrans %}
> </h6>
> <div class="recent-summary">
> {{ blog_post.content|safe|truncatewords_html:100 }}
> <p class="blog-list-detail">
> <a href="{{ blog_post.get_absolute_url }}">{% trans "read more"
> %}</a>
> </p>
> </div>
> {% endfor %}
> <p><a href="/blog"><i>Read more news</i></a></p>
> </div>
> {% endif %}
>
> {% endblock %}
>
> Hope this helps!
>
> Seeya. Danny.
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.