django_blog/blog/templates/blog/post_list.html
2017-12-08 02:18:43 +03:00

31 lines
848 B
HTML

{% extends 'blog/base.html' %}
{% comment %} {% load pagination_tags %} {% endcomment %}
{% block content %}
{% if posts %}
{% for post in posts %}
<div class="post">
<div class="post-header">
<h2><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h2>
<div class="date"><i class="fa fa-calendar"></i> {{ post.published_date}}</div>
{% if post.tags.names %}
<div class="tag">
<i class="fa fa-tags"></i>
{% for tag in post.tags.names %}
<a href="{% url 'post_list' tag=tag%}">{{ tag }}</a>
{% endfor %}
</div>
{% endif %}
</div>
{{ post.text|safe|linebreaksbr|truncatewords:80 }} <!--|linebreaksbr|truncatewords:80 }}</p--><br>
</div>
{% endfor %}
{% else %}
<div class="post">
<p>Ничего не найдено</p>
</div>
{% endif %}
{% endblock content %}